mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-18 17:21:33 +00:00
feat: same error for invalid user or pass on login
every now and then i got curious of what people add to their forks,
and sometimes i'd be like, "hey, that makes sense!"
i remember that back in the days, i switched to nunjucks because of
someone's fork too
we used to use handlebars, which i've had some misgivings with for
awhile back then
either way all i'm saying is that it's the case this time around with
this commit
thanks for reading
49d12004e8
This commit is contained in:
parent
630d95be02
commit
9cc4832717
@ -48,7 +48,7 @@ self.verify = async (req, res, next) => {
|
||||
.where('username', username)
|
||||
.first()
|
||||
|
||||
if (!user) throw new ClientError('Username does not exist.')
|
||||
if (!user) throw new ClientError('Wrong credentials.', { statusCode: 403 })
|
||||
|
||||
if (user.enabled === false || user.enabled === 0) {
|
||||
throw new ClientError('This account has been disabled.', { statusCode: 403 })
|
||||
@ -56,7 +56,7 @@ self.verify = async (req, res, next) => {
|
||||
|
||||
const result = await bcrypt.compare(password, user.password)
|
||||
if (result === false) {
|
||||
throw new ClientError('Wrong password.', { statusCode: 403 })
|
||||
throw new ClientError('Wrong credentials.', { statusCode: 403 })
|
||||
} else {
|
||||
await res.json({ success: true, token: user.token })
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user