Skip to content

Commit

Permalink
Merge pull request #11 from MindsHub/develop
Browse files Browse the repository at this point in the history
no  mail no party
  • Loading branch information
Usioumeo authored Oct 21, 2023
2 parents 2fcacd5 + da92d50 commit 2389dd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/auth/login.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rocket::{
form::Form,
http::{Cookie, CookieJar, Status},
http::{Cookie, CookieJar},
serde::json::Json, State,
};

Expand Down
15 changes: 9 additions & 6 deletions src/auth/signup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -53,15 +54,15 @@ impl SignupInfo {
#[post("/signup", format = "form", data = "<create_info>")]
pub async fn signup(
mut create_info: Form<SignupInfo>,
mailer: &State<MailBuilder>,
//mailer: &State<MailBuilder>,
config: &State<InsignoConfig>,
connection: Db,
scrypt_semaphore: &State<ScryptSemaphore>,
) -> Result<String, InsignoError> {
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(&params)
Expand All @@ -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())
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 protected]";
let response = client
Expand Down

0 comments on commit 2389dd5

Please sign in to comment.