mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-26 13:48:53 +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:
parent
20e8593d4f
commit
822a607e31
@ -36,4 +36,7 @@ var (
|
|||||||
|
|
||||||
// ErrWrongSecret indicates a wrong secret was provided.
|
// ErrWrongSecret indicates a wrong secret was provided.
|
||||||
ErrWrongSecret = New("wrong secret")
|
ErrWrongSecret = New("wrong secret")
|
||||||
|
|
||||||
|
// ErrLogin indicates wrong login credentials.
|
||||||
|
ErrLogin = New("invalid user id or secret")
|
||||||
)
|
)
|
||||||
|
@ -115,7 +115,7 @@ func (svc service) IssueToken(ctx context.Context, identity, secret string) (jwt
|
|||||||
return jwt.Token{}, errors.Wrap(errors.ErrAuthentication, err)
|
return jwt.Token{}, errors.Wrap(errors.ErrAuthentication, err)
|
||||||
}
|
}
|
||||||
if err := svc.hasher.Compare(secret, dbUser.Credentials.Secret); err != nil {
|
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{
|
claims := jwt.Claims{
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
const cost int = 10
|
const cost int = 10
|
||||||
|
|
||||||
var (
|
var (
|
||||||
errHashPassword = errors.New("Generate hash from password failed")
|
errHashPassword = errors.New("generate hash from password failed")
|
||||||
errComparePassword = errors.New("Compare hash and password failed")
|
errComparePassword = errors.New("compare hash and password failed")
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ clients.Hasher = (*bcryptHasher)(nil)
|
var _ clients.Hasher = (*bcryptHasher)(nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user