Rewrite README + use lettre crate to validate email address instead of regex
This commit is contained in:
parent
67e13d9074
commit
65489e7692
8 changed files with 62 additions and 85 deletions
|
|
@ -13,6 +13,7 @@ use axum_extra::extract::{
|
|||
Host,
|
||||
};
|
||||
use chrono::Duration;
|
||||
use lettre::Address;
|
||||
use rinja::Template;
|
||||
use serde::Deserialize;
|
||||
use tracing::{event, Level};
|
||||
|
|
@ -109,9 +110,7 @@ pub async fn sign_up_post(
|
|||
}
|
||||
|
||||
// Validation of email and password.
|
||||
if let common::utils::EmailValidation::NotValid =
|
||||
common::utils::validate_email(&form_data.email)
|
||||
{
|
||||
if form_data.email.parse::<Address>().is_err() {
|
||||
return error_response(SignUpError::InvalidEmail, &form_data, user, tr);
|
||||
}
|
||||
|
||||
|
|
@ -431,9 +430,7 @@ pub async fn ask_reset_password_post(
|
|||
}
|
||||
|
||||
// Validation of email.
|
||||
if let common::utils::EmailValidation::NotValid =
|
||||
common::utils::validate_email(&form_data.email)
|
||||
{
|
||||
if form_data.email.parse::<Address>().is_err() {
|
||||
return error_response(
|
||||
AskResetPasswordError::InvalidEmail,
|
||||
&form_data.email,
|
||||
|
|
@ -721,9 +718,7 @@ pub async fn edit_user_post(
|
|||
.into_response())
|
||||
}
|
||||
|
||||
if let common::utils::EmailValidation::NotValid =
|
||||
common::utils::validate_email(&form_data.email)
|
||||
{
|
||||
if form_data.email.parse::<Address>().is_err() {
|
||||
return error_response(ProfileUpdateError::InvalidEmail, &form_data, user, tr);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue