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:
Bobby 2022-05-24 06:56:58 +07:00
parent 630d95be02
commit 9cc4832717
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09
1 changed files with 2 additions and 2 deletions

View File

@ -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 })
}