mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Show error message when a disabled user tries to authenticate
This commit is contained in:
parent
b0ce023f49
commit
b4372dff36
@ -32,7 +32,7 @@ export default {
|
|||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
const result = await session.run(
|
const result = await session.run(
|
||||||
'MATCH (user:User {email: $userEmail}) ' +
|
'MATCH (user:User {email: $userEmail}) ' +
|
||||||
'RETURN user {.id, .slug, .name, .avatar, .email, .password, .role} as user LIMIT 1',
|
'RETURN user {.id, .slug, .name, .avatar, .email, .password, .role, .disabled} as user LIMIT 1',
|
||||||
{
|
{
|
||||||
userEmail: email
|
userEmail: email
|
||||||
}
|
}
|
||||||
@ -45,11 +45,18 @@ export default {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
currentUser &&
|
currentUser &&
|
||||||
(await bcrypt.compareSync(password, currentUser.password))
|
(await bcrypt.compareSync(password, currentUser.password)) &&
|
||||||
|
currentUser.disabled == false
|
||||||
) {
|
) {
|
||||||
delete currentUser.password
|
delete currentUser.password
|
||||||
return encode(currentUser)
|
return encode(currentUser)
|
||||||
} else {
|
}
|
||||||
|
else if (currentUser &&
|
||||||
|
currentUser.disabled
|
||||||
|
){
|
||||||
|
throw new AuthenticationError('Your account has been disabled.')
|
||||||
|
}
|
||||||
|
else {
|
||||||
throw new AuthenticationError('Incorrect email address or password.')
|
throw new AuthenticationError('Incorrect email address or password.')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user