]> Untitled Git - lemmy.git/commitdiff
Case-insensitive username at login (#2010)
authorKradyz <81911574+Kradyz@users.noreply.github.com>
Wed, 26 Jan 2022 18:05:07 +0000 (19:05 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Jan 2022 18:05:07 +0000 (18:05 +0000)
* Case-insensitive username at login

* formatting

Co-authored-by: Kradyz <k@radiz.nl>
crates/db_views/src/local_user_view.rs

index 23e81d3651eb66c720da32a9cc0c62057d944430..e2453a40d39634d63c8a068cfc6066da053510e4 100644 (file)
@@ -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((