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
Этот коммит содержится в:
Ruzette Tanyag
2017-02-07 11:54:07 -05:00
коммит произвёл Christopher Speller
родитель 5cc30fa061
Коммит d91fea6518
6 изменённых файлов: 134 добавлений и 4 удалений

Просмотреть файл

@@ -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