Convert emails to lowercase (fixes #2462) (#2463)

This commit is contained in:
Nutomic 2022-09-27 16:02:04 +00:00 committed by GitHub
parent 3c5368d8b1
commit f2537ba7db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ impl Perform for PasswordReset {
let data: &PasswordReset = self; let data: &PasswordReset = self;
// Fetch that email // Fetch that email
let email = data.email.clone(); let email = data.email.to_lowercase();
let local_user_view = blocking(context.pool(), move |conn| { let local_user_view = blocking(context.pool(), move |conn| {
LocalUserView::find_by_email(conn, &email) LocalUserView::find_by_email(conn, &email)
}) })

View File

@ -42,7 +42,7 @@ impl Perform for SaveUserSettings {
let display_name = diesel_option_overwrite(&data.display_name); let display_name = diesel_option_overwrite(&data.display_name);
let matrix_user_id = diesel_option_overwrite(&data.matrix_user_id); let matrix_user_id = diesel_option_overwrite(&data.matrix_user_id);
let bot_account = data.bot_account; let bot_account = data.bot_account;
let email_deref = data.email.as_deref().map(|e| e.to_owned()); let email_deref = data.email.as_deref().map(|e| e.to_lowercase());
let email = diesel_option_overwrite(&email_deref); let email = diesel_option_overwrite(&email_deref);
if let Some(Some(email)) = &email { if let Some(Some(email)) = &email {

View File

@ -137,7 +137,7 @@ impl PerformCrud for Register {
// Create the local user // Create the local user
let local_user_form = LocalUserForm { let local_user_form = LocalUserForm {
person_id: Some(inserted_person.id), person_id: Some(inserted_person.id),
email: Some(data.email.as_deref().map(|s| s.to_owned())), email: Some(data.email.as_deref().map(|s| s.to_lowercase())),
password_encrypted: Some(data.password.to_string()), password_encrypted: Some(data.password.to_string()),
show_nsfw: Some(data.show_nsfw), show_nsfw: Some(data.show_nsfw),
email_verified: Some(false), email_verified: Some(false),