Automatically remove outdated account creation requests
This commit is contained in:
@ -31,6 +31,9 @@ pub async fn create_account(remote_ip: RemoteIP, req: web::Json<CreateAccountBod
|
||||
return Ok(HttpResponse::BadRequest().json("Size constraints were not respected!"));
|
||||
}
|
||||
|
||||
// Perform cleanup
|
||||
users_service::delete_not_validated_accounts().await?;
|
||||
|
||||
// Check if email is already attached to an account
|
||||
if users_service::exists_email(&req.email).await? {
|
||||
return Ok(
|
||||
@ -44,8 +47,6 @@ pub async fn create_account(remote_ip: RemoteIP, req: web::Json<CreateAccountBod
|
||||
// Trigger reset password (send mail)
|
||||
users_service::request_reset_password(&mut user).await?;
|
||||
|
||||
// TODO : cleanup in a cron not validated accounts after 24 hours
|
||||
|
||||
// Account successfully created
|
||||
Ok(HttpResponse::Created().finish())
|
||||
}
|
||||
|
Reference in New Issue
Block a user