fix: login with disabled used
This commit is contained in:
parent
9d028897bd
commit
6eaebc3108
1 changed files with 1 additions and 2 deletions
|
|
@ -1,6 +1,5 @@
|
|||
const otplib = require('otplib')
|
||||
const bcrypt = require('bcrypt')
|
||||
const { AuthenticationError } = require('apollo-server-express')
|
||||
|
||||
const loginHelper = require('../../services/login')
|
||||
const T = require('../../../time')
|
||||
|
|
@ -14,7 +13,7 @@ function authenticateUser(username, password) {
|
|||
return users.getUserByUsername(username)
|
||||
.then(user => {
|
||||
const hashedPassword = user.password
|
||||
if (!hashedPassword) throw new authErrors.InvalidCredentialsError()
|
||||
if (!hashedPassword || !user.enabled) throw new authErrors.InvalidCredentialsError()
|
||||
return Promise.all([bcrypt.compare(password, hashedPassword), hashedPassword])
|
||||
})
|
||||
.then(([isMatch, hashedPassword]) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue