mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-02-17 08:59:46 +03:00
changed login route
This commit is contained in:
parent
6e63771868
commit
343c37ae1c
7 changed files with 13 additions and 345 deletions
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
|||
default: build-frontend
|
||||
cargo build
|
||||
|
||||
run: build-frontend-dev
|
||||
run: build-frontend
|
||||
cargo run
|
||||
|
||||
dev-env:
|
||||
|
|
|
@ -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);
|
||||
|
|
24
src/main.rs
24
src/main.rs
|
@ -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
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const ROUTES = {
|
||||
registerUser: '/join/',
|
||||
|
||||
loginUser: '/',
|
||||
loginUser: '/login/',
|
||||
|
||||
signoutUser: '/api/v1/signout',
|
||||
|
||||
panelHome: '/panel/',
|
||||
panelHome: '/',
|
||||
|
||||
docsHome: '/docs/',
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue