fix: add error message in login (#8010)

* fix: add error message in login

* fix: use newf
This commit is contained in:
Nityananda Gohain 2025-05-22 21:53:54 +05:30 committed by GitHub
parent 0bfe53a93c
commit a1c7a948fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -310,7 +310,9 @@ func (m *Module) GetAuthenticatedUser(ctx context.Context, orgID, email, passwor
if err != nil {
return nil, err
}
if len(user) == 1 {
if len(user) == 0 {
return nil, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "user with email: %s does not exist", email)
} else if len(user) == 1 {
dbUser = &user[0].User
} else {
return nil, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "please provide an orgID")