diff --git a/plume-models/src/email_signups.rs b/plume-models/src/email_signups.rs index c6cf4000..16219778 100644 --- a/plume-models/src/email_signups.rs +++ b/plume-models/src/email_signups.rs @@ -131,7 +131,8 @@ impl EmailSignup { } fn delete_existings_by_email(conn: &DbConn, email: &str) -> Result { - let existing_signups = email_signups::table.filter(email_signups::email.to_lowercase().eq(email.to_lowercase())); + let existing_signups = email_signups::table + .filter(email_signups::email.to_lowercase().eq(email.to_lowercase())); diesel::delete(existing_signups) .execute(&**conn) .map_err(Error::from) diff --git a/plume-models/src/password_reset_requests.rs b/plume-models/src/password_reset_requests.rs index addb54ca..b2f91871 100644 --- a/plume-models/src/password_reset_requests.rs +++ b/plume-models/src/password_reset_requests.rs @@ -23,8 +23,11 @@ const TOKEN_VALIDITY_HOURS: i64 = 2; impl PasswordResetRequest { pub fn insert(conn: &Connection, email: &str) -> Result { // first, delete other password reset tokens associated with this email: - let existing_requests = - password_reset_requests::table.filter(password_reset_requests::email.to_lowercase().eq(email.to_lowercase())); + let existing_requests = password_reset_requests::table.filter( + password_reset_requests::email + .to_lowercase() + .eq(email.to_lowercase()), + ); diesel::delete(existing_requests).execute(conn)?; // now, generate a random token, set the expiry date, diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 6ba86e4f..54b5ee35 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -61,7 +61,7 @@ pub struct User { pub outbox_url: String, pub inbox_url: String, pub summary: String, - pub email : Option, + pub email: Option, pub hashed_password: Option, pub instance_id: i32, pub creation_date: NaiveDateTime, @@ -204,9 +204,9 @@ impl User { } /** - * TODO: Should create user record with normalized(lowercased) email - DONE: Store email case-sensitive but always compare them after lowering - */ + * TODO: Should create user record with normalized(lowercased) email + DONE: Store email case-sensitive but always compare them after lowering + */ pub fn email_used(conn: &DbConn, email: &str) -> Result { use diesel::dsl::{exists, select}; @@ -214,7 +214,7 @@ impl User { select(exists( users::table .filter(users::instance_id.eq(Instance::get_local()?.id)) - .filter(users::email.to_lowercase().eq(lower_email)) + .filter(users::email.to_lowercase().eq(lower_email)), )) .get_result(&**conn) .map_err(Error::from) diff --git a/src/routes/email_signups.rs b/src/routes/email_signups.rs index 294d496b..b9a2a089 100644 --- a/src/routes/email_signups.rs +++ b/src/routes/email_signups.rs @@ -31,7 +31,11 @@ pub struct EmailSignupForm { } fn emails_match(form: &EmailSignupForm) -> Result<(), ValidationError> { - if form.email_confirmation.to_lowercase().eq(form.email.to_lowercase()) { + if form + .email_confirmation + .to_lowercase() + .eq(form.email.to_lowercase()) + { Ok(()) } else { Err(ValidationError::new("emails_match"))