migrated-db #557

Merged
philipp merged 5 commits from migrated-db into staging 2024-05-28 11:27:43 +02:00
2 changed files with 4 additions and 6 deletions

View File

@ -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 SELECT id, name, pw, deleted, last_access, dob, weight, sex, member_since_date, birthdate, mail, nickname, notes, phone, address, family_id
FROM user FROM user
WHERE name=? WHERE lower(name)=?
", ",
name name
) )
@ -705,8 +705,8 @@ ORDER BY last_access DESC
} }
pub async fn login(db: &SqlitePool, name: &str, pw: &str) -> Result<Self, LoginError> { pub async fn login(db: &SqlitePool, name: &str, pw: &str) -> Result<Self, LoginError> {
let name = name.trim(); // just to make sure... let name = name.trim().to_lowercase(); // just to make sure...
let Some(user) = User::find_by_name(db, name).await else { let Some(user) = User::find_by_name(db, &name).await else {
if ![ if ![
"n-sageder", "n-sageder",
"p-hofer", "p-hofer",
@ -737,7 +737,7 @@ ORDER BY last_access DESC
"d.kortschak", "d.kortschak",
"[login]", "[login]",
] ]
.contains(&name) .contains(&name.as_str())
{ {
Log::create(db, format!("Username ({name}) not found (tried to login)")).await; Log::create(db, format!("Username ({name}) not found (tried to login)")).await;
} }

View File

@ -1,5 +1,3 @@
update role set name='manage_events' where id=19;
-- test user -- test user
INSERT INTO user(name) VALUES('Marie'); 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')); INSERT INTO "user_role" (user_id, role_id) VALUES((SELECT id from user where name = 'Marie'),(SELECT id FROM role where name = 'Donau Linz'));