use sql lower function
This commit is contained in:
parent
ff380771a3
commit
3408ceae43
@ -132,7 +132,7 @@ impl EmailSignup {
|
||||
|
||||
fn delete_existings_by_email(conn: &DbConn, email: &str) -> Result<usize> {
|
||||
let existing_signups = email_signups::table
|
||||
.filter(email_signups::email.to_lowercase().eq(email.to_lowercase()));
|
||||
.filter(lower(email_signups::email).eq(email.to_lowercase()));
|
||||
diesel::delete(existing_signups)
|
||||
.execute(&**conn)
|
||||
.map_err(Error::from)
|
||||
|
@ -24,8 +24,7 @@ impl PasswordResetRequest {
|
||||
pub fn insert(conn: &Connection, email: &str) -> Result<String> {
|
||||
// first, delete other password reset tokens associated with this email:
|
||||
let existing_requests = password_reset_requests::table.filter(
|
||||
password_reset_requests::email
|
||||
.to_lowercase()
|
||||
lower(password_reset_requests::email)
|
||||
.eq(email.to_lowercase()),
|
||||
);
|
||||
diesel::delete(existing_requests).execute(conn)?;
|
||||
|
@ -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(lower(users::email).eq(lower_email)),
|
||||
))
|
||||
.get_result(&**conn)
|
||||
.map_err(Error::from)
|
||||
|
Loading…
Reference in New Issue
Block a user