mirror of
https://git.waldn.net/git/knotteye/satyr.git
synced 2026-11-20 21:19:05 +00:00
Fix throwing unhandled promise rejection if user doesn't exist in validatePasswordRedirect user to /profile on successful login
This commit is contained in:
1 parent
be38b873eb
commit
8c17149f39
2 files changed
+15
-4
No files matched your search
+6
-2
@@ -45,8 +45,12 @@ async function query(query: string){
|
||||
}
|
||||
|
||||
async function validatePassword(username: string, password: string){
|
||||
let pass: any = await query('select password_hash from users where username='+raw.escape(username)+' limit 1');
|
||||
return await bcrypt.compare(password, pass[0].password_hash.toString());
|
||||
try {
|
||||
let pass: any = await query('select password_hash from users where username='+raw.escape(username)+' limit 1');
|
||||
return await bcrypt.compare(password, pass[0].password_hash.toString());
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function hash(pwd){
|
||||
|
||||
Reference in new issue
Block a user