From da92d505444d961eeb6645da7d6dd9888f8b7bf8 Mon Sep 17 00:00:00 2001 From: AlessioZeni Date: Sat, 21 Oct 2023 11:33:14 +0200 Subject: [PATCH] no mail no party --- src/auth/login.rs | 2 +- src/auth/signup.rs | 15 +++++++++------ src/test/mod.rs | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/auth/login.rs b/src/auth/login.rs index e422a1a..194bbbc 100644 --- a/src/auth/login.rs +++ b/src/auth/login.rs @@ -1,6 +1,6 @@ use rocket::{ form::Form, - http::{Cookie, CookieJar, Status}, + http::{Cookie, CookieJar}, serde::json::Json, State, }; diff --git a/src/auth/signup.rs b/src/auth/signup.rs index fe9f967..1f6070f 100644 --- a/src/auth/signup.rs +++ b/src/auth/signup.rs @@ -4,11 +4,12 @@ use rocket::{form::Form, http::ContentType, tokio::task::spawn_blocking, State}; use crate::{ db::Db, - mail::MailBuilder, + //mail::MailBuilder, pending::{Pending, PendingAction}, utils::InsignoError, InsignoConfig, }; +//use crate::auth::login::login; use super::{ user::{User, UserDiesel}, @@ -53,7 +54,7 @@ impl SignupInfo { #[post("/signup", format = "form", data = "")] pub async fn signup( mut create_info: Form, - mailer: &State, + //mailer: &State, config: &State, connection: Db, scrypt_semaphore: &State, @@ -61,7 +62,7 @@ pub async fn signup( create_info.sanitize()?; let permit = config.scrypt.clone().await; let params = permit.get_params(); - let sem=scrypt_semaphore.aquire(); + let sem=scrypt_semaphore.aquire().await?; let create_info = spawn_blocking(move || { create_info .hash_password(¶ms) @@ -86,11 +87,13 @@ pub async fn signup( create_info.password.clone(), )); pend.insert(&connection).await?; - let link = format!("https://insigno.mindshub.it/verify/{}", pend.token); - mailer + //let link = format!("https://insigno.mindshub.it/verify/{}", pend.token); + complete_registration(PendingAction::RegisterUser(create_info.name.clone(), create_info.email.clone(), create_info.password.clone()), &connection) + .await?; + /*mailer .send_registration_mail(&create_info.email, &create_info.name, &link) .await - .map_err(|e| InsignoError::new(500).debug(e))?; + .map_err(|e| InsignoError::new(500).debug(e))?;*/ Ok("mail inviata".to_string()) } diff --git a/src/test/mod.rs b/src/test/mod.rs index 73f1dd8..645f0bf 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -37,8 +37,8 @@ pub async fn test_signup(client: &Client) -> i64 { .await; assert_eq!(response.status(), Status::Ok); - let response = client.get("/verify/11111111111111111111").dispatch().await; - assert_eq!(response.status(), Status::Ok); + //let response = client.get("/verify/11111111111111111111").dispatch().await; + //assert_eq!(response.status(), Status::Ok); let data = "password=Testtes1!&email=test@test.com"; let response = client