changed login route

This commit is contained in:
realaravinth 2021-04-30 18:06:28 +05:30
parent 6e63771868
commit 343c37ae1c
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
7 changed files with 13 additions and 345 deletions

View file

@ -2,7 +2,7 @@
default: build-frontend
cargo build
run: build-frontend-dev
run: build-frontend
cargo run
dev-env:

View file

@ -26,30 +26,7 @@ pub use super::mcaptcha::duration::GetDurationResp;
pub use super::mcaptcha::is_authenticated;
pub use super::mcaptcha::levels::I32Levels;
//lazy_static! {
// pub static ref CORS: Cors = Cors::default()
// .allow_any_origin()
// .allowed_methods(vec!["POST"])
// .allow_any_header()
// .max_age(0)
// .send_wildcard();
//}
//pub fn services(cfg: &mut web::ServiceConfig) -> web::Scope<impl actix_service::ServiceFactory> {
// let captcha_api_cors = Cors::default()
// .allow_any_origin()
// .allowed_methods(vec!["POST"])
// .allow_any_header()
// .max_age(0)
// .send_wildcard();
//
// web::scope("/api/v1/pow/*")
// .wrap(captcha_api_cors)
// .configure(pow_services)
//
// // pow
//}
// middleware protected by scope
pub fn services(cfg: &mut web::ServiceConfig) {
let captcha_api_cors = Cors::default()
.allow_any_origin()
@ -63,14 +40,11 @@ pub fn services(cfg: &mut web::ServiceConfig) {
.wrap(captcha_api_cors)
.configure(intenral_services),
);
// cfg.service(
// cfg.service(get_config::get_config);
// cfg.service(verify_pow::verify_pow);
// cfg.service(verify_token::validate_captcha_token);
}
// internal route aggregator, it's easy to use macros
// to denote paths than having to type it out
// but remember, final path = scope + macro path
fn intenral_services(cfg: &mut web::ServiceConfig) {
cfg.service(get_config::get_config);
cfg.service(verify_pow::verify_pow);

View file

@ -21,16 +21,14 @@ use actix_web::{
client::Client, error::InternalError, http::StatusCode, middleware, web::JsonConfig, App,
HttpServer,
};
//use awc::Client;
use cache_buster::Files as FileMap;
use lazy_static::lazy_static;
use log::info;
mod data;
mod errors;
//mod routes;
mod api;
mod data;
mod docs;
mod errors;
mod settings;
mod static_assets;
mod templates;
@ -43,15 +41,10 @@ pub use settings::Settings;
lazy_static! {
pub static ref SETTINGS: Settings = Settings::new().unwrap();
// pub static ref GIT_COMMIT_HASH: String = env::var("GIT_HASH").unwrap();
// pub static ref OPEN_API_DOC: String = env::var("OPEN_API_DOCS").unwrap();
pub static ref S: String = env::var("S").unwrap();
pub static ref FILES: FileMap = FileMap::load();
pub static ref JS: &'static str = FILES.get("./static/bundle/main.js").unwrap();
pub static ref CSS: &'static str = FILES.get("./static/bundle/main.css").unwrap();
}
pub static OPEN_API_DOC: &str = env!("OPEN_API_DOCS");
@ -80,13 +73,6 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(move || {
let client = Client::default();
// let captcha_api_cors = Cors::default()
// .allow_any_origin()
// .allowed_methods(vec!["POST"])
// .allow_any_header()
// .max_age(0)
// .send_wildcard();
App::new()
.wrap(middleware::Logger::default())
.wrap(get_identity_service())
@ -98,16 +84,10 @@ async fn main() -> std::io::Result<()> {
))
.configure(v1::pow::services)
.configure(v1::services)
//.service(
// scope("/")
// .wrap(captcha_api_cors)
// .configure(v1::pow::services),
//)
.configure(docs::services)
.configure(templates::services)
.configure(static_assets::services)
.app_data(get_json_err())
// .service(Files::new("/", "./prod"))
})
.bind(SETTINGS.server.get_ip())
.unwrap()

File diff suppressed because one or more lines are too long

View file

@ -57,7 +57,7 @@
<div class="form__secondary-action">
<p class="form__secondary-action__banner">
Already have an account?
<a href="/" class="form__secondary-action__link">Log in</a>
<a href="/login" class="form__secondary-action__link">Log in</a>
</p>
</div>
</div>

View file

@ -8,9 +8,9 @@ import './panel/main.scss';
const router = new Router();
router.register('/', login.index);
router.register('/', panel.index);
router.register('/register', register.index);
router.register('/panel/', panel.index);
router.register('/login', login.index);
router.register('/panel/layout.html/', panel.index);
router.route();

View file

@ -1,11 +1,11 @@
const ROUTES = {
registerUser: '/join/',
loginUser: '/',
loginUser: '/login/',
signoutUser: '/api/v1/signout',
panelHome: '/panel/',
panelHome: '/',
docsHome: '/docs/',