mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +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);
|
const user = await sails.helpers.users.getOneByEmailOrUsername(inputs.emailOrUsername);
|
||||||
|
|
||||||
if (user.isSso) {
|
|
||||||
throw Errors.USE_SINGLE_SIGN_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
sails.log.warn(
|
sails.log.warn(
|
||||||
`Invalid email or username: "${inputs.emailOrUsername}"! (IP: ${remoteAddress})`,
|
`Invalid email or username: "${inputs.emailOrUsername}"! (IP: ${remoteAddress})`,
|
||||||
|
@ -61,6 +57,10 @@ module.exports = {
|
||||||
throw Errors.INVALID_EMAIL_OR_USERNAME;
|
throw Errors.INVALID_EMAIL_OR_USERNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.isSso) {
|
||||||
|
throw Errors.USE_SINGLE_SIGN_ON;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bcrypt.compareSync(inputs.password, user.password)) {
|
if (!bcrypt.compareSync(inputs.password, user.password)) {
|
||||||
sails.log.warn(`Invalid password! (IP: ${remoteAddress})`);
|
sails.log.warn(`Invalid password! (IP: ${remoteAddress})`);
|
||||||
throw Errors.INVALID_PASSWORD;
|
throw Errors.INVALID_PASSWORD;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue