mirror of
https://git.waldn.net/git/knotteye/satyr.git
synced 2025-09-15 22:24:57 +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:
@ -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