mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(auth): handle sign-in attempts from emails with no password (#933)
* fix(auth): dont reject promise when missing password * fix(auth): use static fallback error message
This commit is contained in:
@@ -108,11 +108,11 @@ export class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public passwordMatch(password: string): Promise<boolean> {
|
public passwordMatch(password: string): Promise<boolean> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => {
|
||||||
if (this.password) {
|
if (this.password) {
|
||||||
resolve(bcrypt.compare(password, this.password));
|
resolve(bcrypt.compare(password, this.password));
|
||||||
} else {
|
} else {
|
||||||
return reject(false);
|
return resolve(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -176,7 +176,10 @@ authRoutes.post('/local', async (req, res, next) => {
|
|||||||
|
|
||||||
return res.status(200).json(user?.filter() ?? {});
|
return res.status(200).json(user?.filter() ?? {});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(e.message, { label: 'Auth' });
|
logger.error('Something went wrong when trying to authenticate', {
|
||||||
|
label: 'Auth',
|
||||||
|
error: e.message,
|
||||||
|
});
|
||||||
return next({
|
return next({
|
||||||
status: 500,
|
status: 500,
|
||||||
message: 'Something went wrong.',
|
message: 'Something went wrong.',
|
||||||
|
Reference in New Issue
Block a user