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:
parent
f438d24c41
commit
57e3c25d3d
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue