NOISSUE - Trim trailing and leading whitespaces in email at login & register (#1687)

* add: trim email in users at login & register

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: trim email in users at login & register

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: trim email in users at login & register

Signed-off-by: Arvindh <arvindh91@gmail.com>

Signed-off-by: Arvindh <arvindh91@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
This commit is contained in:
Arvindh 2022-12-21 23:33:52 +05:30 committed by GitHub
parent f438d24c41
commit 57e3c25d3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -200,7 +200,7 @@ func decodeCredentials(_ context.Context, r *http.Request) (interface{}, error)
if err := json.NewDecoder(r.Body).Decode(&user); err != nil {
return nil, errors.Wrap(errors.ErrMalformedEntity, err)
}
user.Email = strings.TrimSpace(user.Email)
return userReq{user}, nil
}
@ -214,6 +214,7 @@ func decodeCreateUserReq(_ context.Context, r *http.Request) (interface{}, error
return nil, errors.Wrap(errors.ErrMalformedEntity, err)
}
user.Email = strings.TrimSpace(user.Email)
req := createUserReq{
user: user,
token: apiutil.ExtractBearerToken(r),