From 083af27351243a49c86897160332eda80bd25346 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Thu, 19 May 2022 19:32:10 +0530 Subject: [PATCH] feat & fix: load verify routes and fix template loads --- src/pages/auth/mod.rs | 1 + src/pages/auth/verify.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/auth/mod.rs b/src/pages/auth/mod.rs index 4f9f7cf..6d1804b 100644 --- a/src/pages/auth/mod.rs +++ b/src/pages/auth/mod.rs @@ -29,4 +29,5 @@ pub fn register_templates(t: &mut tera::Tera) { pub fn services(cfg: &mut actix_web::web::ServiceConfig) { add::services(cfg); + verify::services(cfg); } diff --git a/src/pages/auth/verify.rs b/src/pages/auth/verify.rs index 712d3e7..cf8e60d 100644 --- a/src/pages/auth/verify.rs +++ b/src/pages/auth/verify.rs @@ -35,7 +35,6 @@ use crate::*; pub use crate::pages::*; pub const TITLE: &str = "Setup spidering"; -pub const AUTH_ADD: TemplateFile = TemplateFile::new("auth_add", "pages/auth/add.html"); pub const AUTH_CHALLENGE: TemplateFile = TemplateFile::new("auth_challenge", "pages/auth/challenge.html"); @@ -66,7 +65,9 @@ impl VerifyChallenge { } pub fn render(&self) -> String { - TEMPLATES.render(AUTH_ADD.name, &self.ctx.borrow()).unwrap() + TEMPLATES + .render(AUTH_CHALLENGE.name, &self.ctx.borrow()) + .unwrap() } pub fn page(s: &Settings, payload: &Challenge) -> String { @@ -76,7 +77,7 @@ impl VerifyChallenge { } #[get(path = "PAGES.auth.verify")] -pub async fn get_add( +pub async fn get_verify( ctx: WebCtx, db: WebDB, query: web::Query, @@ -98,8 +99,8 @@ pub async fn get_add( } pub fn services(cfg: &mut web::ServiceConfig) { - cfg.service(get_add); - cfg.service(add_submit); + cfg.service(get_verify); + cfg.service(submit_verify); } async fn _get_challenge( @@ -112,7 +113,7 @@ async fn _get_challenge( } #[post(path = "PAGES.auth.verify")] -pub async fn add_submit( +pub async fn submit_verify( payload: web::Form, ctx: WebCtx, db: WebDB,