mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 12:49:43 +02:00
fix: Fix order of checks when logging in
This commit is contained in:
parent
9ea3e1ab0d
commit
1ef736106c
1 changed files with 4 additions and 4 deletions
|
@ -50,10 +50,6 @@ module.exports = {
|
|||
|
||||
const user = await sails.helpers.users.getOneByEmailOrUsername(inputs.emailOrUsername);
|
||||
|
||||
if (user.isSso) {
|
||||
throw Errors.USE_SINGLE_SIGN_ON;
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
sails.log.warn(
|
||||
`Invalid email or username: "${inputs.emailOrUsername}"! (IP: ${remoteAddress})`,
|
||||
|
@ -61,6 +57,10 @@ module.exports = {
|
|||
throw Errors.INVALID_EMAIL_OR_USERNAME;
|
||||
}
|
||||
|
||||
if (user.isSso) {
|
||||
throw Errors.USE_SINGLE_SIGN_ON;
|
||||
}
|
||||
|
||||
if (!bcrypt.compareSync(inputs.password, user.password)) {
|
||||
sails.log.warn(`Invalid password! (IP: ${remoteAddress})`);
|
||||
throw Errors.INVALID_PASSWORD;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue