mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
changed login route
This commit is contained in:
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@
|
|||||||
default: build-frontend
|
default: build-frontend
|
||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
run: build-frontend-dev
|
run: build-frontend
|
||||||
cargo run
|
cargo run
|
||||||
|
|
||||||
dev-env:
|
dev-env:
|
||||||
|
|||||||
@@ -26,30 +26,7 @@ pub use super::mcaptcha::duration::GetDurationResp;
|
|||||||
pub use super::mcaptcha::is_authenticated;
|
pub use super::mcaptcha::is_authenticated;
|
||||||
pub use super::mcaptcha::levels::I32Levels;
|
pub use super::mcaptcha::levels::I32Levels;
|
||||||
|
|
||||||
//lazy_static! {
|
// middleware protected by scope
|
||||||
// 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
|
|
||||||
//}
|
|
||||||
|
|
||||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||||
let captcha_api_cors = Cors::default()
|
let captcha_api_cors = Cors::default()
|
||||||
.allow_any_origin()
|
.allow_any_origin()
|
||||||
@@ -63,14 +40,11 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
|||||||
.wrap(captcha_api_cors)
|
.wrap(captcha_api_cors)
|
||||||
.configure(intenral_services),
|
.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) {
|
fn intenral_services(cfg: &mut web::ServiceConfig) {
|
||||||
cfg.service(get_config::get_config);
|
cfg.service(get_config::get_config);
|
||||||
cfg.service(verify_pow::verify_pow);
|
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,
|
client::Client, error::InternalError, http::StatusCode, middleware, web::JsonConfig, App,
|
||||||
HttpServer,
|
HttpServer,
|
||||||
};
|
};
|
||||||
//use awc::Client;
|
|
||||||
use cache_buster::Files as FileMap;
|
use cache_buster::Files as FileMap;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::info;
|
use log::info;
|
||||||
|
|
||||||
mod data;
|
|
||||||
mod errors;
|
|
||||||
//mod routes;
|
|
||||||
mod api;
|
mod api;
|
||||||
|
mod data;
|
||||||
mod docs;
|
mod docs;
|
||||||
|
mod errors;
|
||||||
mod settings;
|
mod settings;
|
||||||
mod static_assets;
|
mod static_assets;
|
||||||
mod templates;
|
mod templates;
|
||||||
@@ -43,15 +41,10 @@ pub use settings::Settings;
|
|||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref SETTINGS: Settings = Settings::new().unwrap();
|
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 S: String = env::var("S").unwrap();
|
||||||
|
|
||||||
pub static ref FILES: FileMap = FileMap::load();
|
pub static ref FILES: FileMap = FileMap::load();
|
||||||
pub static ref JS: &'static str = FILES.get("./static/bundle/main.js").unwrap();
|
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 ref CSS: &'static str = FILES.get("./static/bundle/main.css").unwrap();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static OPEN_API_DOC: &str = env!("OPEN_API_DOCS");
|
pub static OPEN_API_DOC: &str = env!("OPEN_API_DOCS");
|
||||||
@@ -80,13 +73,6 @@ async fn main() -> std::io::Result<()> {
|
|||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
let client = Client::default();
|
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()
|
App::new()
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
.wrap(get_identity_service())
|
.wrap(get_identity_service())
|
||||||
@@ -98,16 +84,10 @@ async fn main() -> std::io::Result<()> {
|
|||||||
))
|
))
|
||||||
.configure(v1::pow::services)
|
.configure(v1::pow::services)
|
||||||
.configure(v1::services)
|
.configure(v1::services)
|
||||||
//.service(
|
|
||||||
// scope("/")
|
|
||||||
// .wrap(captcha_api_cors)
|
|
||||||
// .configure(v1::pow::services),
|
|
||||||
//)
|
|
||||||
.configure(docs::services)
|
.configure(docs::services)
|
||||||
.configure(templates::services)
|
.configure(templates::services)
|
||||||
.configure(static_assets::services)
|
.configure(static_assets::services)
|
||||||
.app_data(get_json_err())
|
.app_data(get_json_err())
|
||||||
// .service(Files::new("/", "./prod"))
|
|
||||||
})
|
})
|
||||||
.bind(SETTINGS.server.get_ip())
|
.bind(SETTINGS.server.get_ip())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -57,7 +57,7 @@
|
|||||||
<div class="form__secondary-action">
|
<div class="form__secondary-action">
|
||||||
<p class="form__secondary-action__banner">
|
<p class="form__secondary-action__banner">
|
||||||
Already have an account?
|
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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import './panel/main.scss';
|
|||||||
|
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
router.register('/', login.index);
|
router.register('/', panel.index);
|
||||||
router.register('/register', register.index);
|
router.register('/register', register.index);
|
||||||
router.register('/panel/', panel.index);
|
router.register('/login', login.index);
|
||||||
router.register('/panel/layout.html/', panel.index);
|
router.register('/panel/layout.html/', panel.index);
|
||||||
|
|
||||||
router.route();
|
router.route();
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
const ROUTES = {
|
const ROUTES = {
|
||||||
registerUser: '/join/',
|
registerUser: '/join/',
|
||||||
|
|
||||||
loginUser: '/',
|
loginUser: '/login/',
|
||||||
|
|
||||||
signoutUser: '/api/v1/signout',
|
signoutUser: '/api/v1/signout',
|
||||||
|
|
||||||
panelHome: '/panel/',
|
panelHome: '/',
|
||||||
|
|
||||||
docsHome: '/docs/',
|
docsHome: '/docs/',
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user