mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 07:00:25 +00:00
SMQ-3159 - Return specific error on non-existent user during login (#3160)
Continuous Delivery / Build and Push (push) Has been cancelled
Check the consistency of generated files / check-generated-files (push) Has been cancelled
Check License Header / check-license (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
Continuous Delivery / Build and Push (push) Has been cancelled
Check the consistency of generated files / check-generated-files (push) Has been cancelled
Check License Header / check-license (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
Signed-off-by: Arvindh <arvindh91@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ var (
|
||||
ErrDomainAuthorization = errors.New("failed to perform authorization over the domain")
|
||||
|
||||
// ErrLogin indicates wrong login credentials.
|
||||
ErrLogin = errors.New("invalid user id or secret")
|
||||
ErrLogin = errors.New("invalid credentials")
|
||||
|
||||
// ErrMalformedEntity indicates a malformed entity specification.
|
||||
ErrMalformedEntity = errors.New("malformed entity specification")
|
||||
|
||||
@@ -182,6 +182,10 @@ func (svc service) IssueToken(ctx context.Context, identity, secret string) (*gr
|
||||
dbUser, err = svc.users.RetrieveByEmail(ctx, identity)
|
||||
}
|
||||
|
||||
if err == repoerr.ErrNotFound {
|
||||
return &grpcTokenV1.Token{}, errors.Wrap(svcerr.ErrLogin, err)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return &grpcTokenV1.Token{}, errors.Wrap(svcerr.ErrAuthentication, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user