From 86f7ca7065d21e390c2dc4d0ffec404b6ff85f2f Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 27 May 2024 08:32:00 +0200 Subject: [PATCH 1/2] don't care about cases for username --- src/model/user.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/model/user.rs b/src/model/user.rs index 32b91c5..add8755 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -491,7 +491,7 @@ WHERE id like ? " SELECT id, name, pw, deleted, last_access, dob, weight, sex, member_since_date, birthdate, mail, nickname, notes, phone, address, family_id FROM user -WHERE name=? +WHERE lower(name)=? ", name ) @@ -705,8 +705,8 @@ ORDER BY last_access DESC } pub async fn login(db: &SqlitePool, name: &str, pw: &str) -> Result { - let name = name.trim(); // just to make sure... - let Some(user) = User::find_by_name(db, name).await else { + let name = name.trim().to_lowercase(); // just to make sure... + let Some(user) = User::find_by_name(db, &name).await else { if ![ "n-sageder", "p-hofer", @@ -737,7 +737,7 @@ ORDER BY last_access DESC "d.kortschak", "[login]", ] - .contains(&name) + .contains(&name.as_str()) { Log::create(db, format!("Username ({name}) not found (tried to login)")).await; } -- 2.45.2 From 9973913af6b3a0b01638923f8a3df1590d375e48 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 28 May 2024 11:26:22 +0200 Subject: [PATCH 2/2] migrated db --- staging-diff.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/staging-diff.sql b/staging-diff.sql index 4303b65..6fb21fc 100644 --- a/staging-diff.sql +++ b/staging-diff.sql @@ -1,5 +1,3 @@ -update role set name='manage_events' where id=19; - -- test user INSERT INTO user(name) VALUES('Marie'); INSERT INTO "user_role" (user_id, role_id) VALUES((SELECT id from user where name = 'Marie'),(SELECT id FROM role where name = 'Donau Linz')); -- 2.45.2