1
0
Fork 0
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:
Maksim Eltyshev 2023-10-18 23:07:57 +02:00
parent 9ea3e1ab0d
commit 1ef736106c

View file

@ -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;