From 1c5c02e1bf561f8e732e09b68b010045c8051e40 Mon Sep 17 00:00:00 2001 From: Kradyz <81911574+Kradyz@users.noreply.github.com> Date: Wed, 26 Jan 2022 19:05:07 +0100 Subject: [PATCH] Case-insensitive username at login (#2010) * Case-insensitive username at login * formatting Co-authored-by: Kradyz --- crates/db_views/src/local_user_view.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/db_views/src/local_user_view.rs b/crates/db_views/src/local_user_view.rs index 23e81d365..e2453a40d 100644 --- a/crates/db_views/src/local_user_view.rs +++ b/crates/db_views/src/local_user_view.rs @@ -1,6 +1,7 @@ use diesel::{result::Error, *}; use lemmy_db_schema::{ aggregates::person_aggregates::PersonAggregates, + functions::lower, newtypes::{LocalUserId, PersonId}, schema::{local_user, person, person_aggregates}, source::{ @@ -81,8 +82,8 @@ impl LocalUserView { .inner_join(person::table) .inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id))) .filter( - person::name - .eq(name_or_email) + lower(person::name) + .eq(lower(name_or_email)) .or(local_user::email.eq(name_or_email)), ) .select((