Case-insensitive username at login (#2010)

* Case-insensitive username at login

* formatting

Co-authored-by: Kradyz <k@radiz.nl>
This commit is contained in:
Kradyz 2022-01-26 19:05:07 +01:00 committed by GitHub
parent e36ad9d984
commit 1c5c02e1bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
use diesel::{result::Error, *}; use diesel::{result::Error, *};
use lemmy_db_schema::{ use lemmy_db_schema::{
aggregates::person_aggregates::PersonAggregates, aggregates::person_aggregates::PersonAggregates,
functions::lower,
newtypes::{LocalUserId, PersonId}, newtypes::{LocalUserId, PersonId},
schema::{local_user, person, person_aggregates}, schema::{local_user, person, person_aggregates},
source::{ source::{
@ -81,8 +82,8 @@ impl LocalUserView {
.inner_join(person::table) .inner_join(person::table)
.inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id))) .inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id)))
.filter( .filter(
person::name lower(person::name)
.eq(name_or_email) .eq(lower(name_or_email))
.or(local_user::email.eq(name_or_email)), .or(local_user::email.eq(name_or_email)),
) )
.select(( .select((