diff options
author | Ruzette Tanyag <ruzette@users.noreply.github.com> | 2017-02-07 11:54:07 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-02-07 11:54:07 -0500 |
commit | d91fea65188a51dd41976cad47f9c8ebacd75a04 (patch) | |
tree | 792f8563d04957c1ddf56a731821051c8466eba7 /app | |
parent | 5cc30fa06149e1291deed6f53de53ecf25600d2c (diff) | |
download | chat-d91fea65188a51dd41976cad47f9c8ebacd75a04.tar.gz chat-d91fea65188a51dd41976cad47f9c8ebacd75a04.tar.bz2 chat-d91fea65188a51dd41976cad47f9c8ebacd75a04.zip |
Implement GET `/users/email/{email}` endpoint for APIv4 (#5309)
* added get user by email endpoint for APIv4
* added get user by email endpoint unit test and driver
* removed the appended return of user ids on logout
* Added RequireEmail to validate user email. Also updated the get user by email endpoint and unit test
Diffstat (limited to 'app')
-rw-r--r-- | app/user.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/user.go b/app/user.go index bc809cfaa..c302db511 100644 --- a/app/user.go +++ b/app/user.go @@ -331,7 +331,12 @@ func GetUserByUsername(username string) (*model.User, *model.AppError) { } func GetUserByEmail(email string) (*model.User, *model.AppError) { - if result := <-Srv.Store.User().GetByEmail(email); result.Err != nil { + + if result := <-Srv.Store.User().GetByEmail(email); result.Err != nil && result.Err.Id == "store.sql_user.missing_account.const"{ + result.Err.StatusCode = http.StatusNotFound + return nil, result.Err + } else if result.Err != nil { + result.Err.StatusCode = http.StatusBadRequest return nil, result.Err } else { return result.Data.(*model.User), nil |