1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-24 13:48:49 +08:00

NOISSUE - Change error description (#1892)

* Change error description

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>

* Fix typo

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>

* Create specific error for login

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>

* Add period to comment

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>

* fix error description

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>

---------

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
This commit is contained in:
Washington Kigani Kamadi 2023-08-23 05:48:03 -07:00 committed by GitHub
parent 20e8593d4f
commit 822a607e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -36,4 +36,7 @@ var (
// ErrWrongSecret indicates a wrong secret was provided.
ErrWrongSecret = New("wrong secret")
// ErrLogin indicates wrong login credentials.
ErrLogin = New("invalid user id or secret")
)

View File

@ -115,7 +115,7 @@ func (svc service) IssueToken(ctx context.Context, identity, secret string) (jwt
return jwt.Token{}, errors.Wrap(errors.ErrAuthentication, err)
}
if err := svc.hasher.Compare(secret, dbUser.Credentials.Secret); err != nil {
return jwt.Token{}, errors.Wrap(errors.ErrWrongSecret, err)
return jwt.Token{}, errors.Wrap(errors.ErrLogin, err)
}
claims := jwt.Claims{

View File

@ -12,8 +12,8 @@ import (
const cost int = 10
var (
errHashPassword = errors.New("Generate hash from password failed")
errComparePassword = errors.New("Compare hash and password failed")
errHashPassword = errors.New("generate hash from password failed")
errComparePassword = errors.New("compare hash and password failed")
)
var _ clients.Hasher = (*bcryptHasher)(nil)