mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
fix: Invalid credentials should throw 401 and not 500 (no-changelog) (#4703)
fix: invalid credentials should throw 401 and not 500 I missed to add these in https://github.com/n8n-io/n8n/pull/4691 I've checked not that there are no other cases of http errors that aren't using error classes. This was the last one.
This commit is contained in:
parent
36dc5f0e66
commit
f63cd3b89e
|
@ -43,11 +43,7 @@ export function authenticationMethods(this: N8nApp): void {
|
|||
}
|
||||
|
||||
if (!user?.password || !(await compareHash(req.body.password, user.password))) {
|
||||
// password is empty until user signs up
|
||||
const error = new Error('Wrong username or password. Do you have caps lock on?');
|
||||
// @ts-ignore
|
||||
error.httpStatusCode = 401;
|
||||
throw error;
|
||||
throw new ResponseHelper.AuthError('Wrong username or password. Do you have caps lock on?');
|
||||
}
|
||||
|
||||
await issueCookie(res, user);
|
||||
|
|
Loading…
Reference in a new issue