summaryrefslogtreecommitdiffstats
path: root/app/login.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-09-28 16:55:14 +0200
committerGitHub <noreply@github.com>2018-09-28 16:55:14 +0200
commita551b375fa6bed975e8df88bf5d024df957a7684 (patch)
tree7170a88a044fa5b346af2f83396bb43b50e6fa4e /app/login.go
parentee672a72e4c534f2d5f36cc563084279ba31ba87 (diff)
downloadchat-a551b375fa6bed975e8df88bf5d024df957a7684.tar.gz
chat-a551b375fa6bed975e8df88bf5d024df957a7684.tar.bz2
chat-a551b375fa6bed975e8df88bf5d024df957a7684.zip
Idiomatic error handling for app/{job,license,login}.go (#9474)
Diffstat (limited to 'app/login.go')
-rw-r--r--app/login.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/app/login.go b/app/login.go
index 5099a3e7a..01cdde386 100644
--- a/app/login.go
+++ b/app/login.go
@@ -96,17 +96,16 @@ func (a *App) GetUserForLogin(id, loginId string) (*model.User, *model.AppError)
// If we are given a userID then fail if we can't find a user with that ID
if len(id) != 0 {
- if user, err := a.GetUser(id); err != nil {
+ user, err := a.GetUser(id)
+ if err != nil {
if err.Id != store.MISSING_ACCOUNT_ERROR {
err.StatusCode = http.StatusInternalServerError
return nil, err
- } else {
- err.StatusCode = http.StatusBadRequest
- return nil, err
}
- } else {
- return user, nil
+ err.StatusCode = http.StatusBadRequest
+ return nil, err
}
+ return user, nil
}
// Try to get the user by username/email
@@ -200,7 +199,6 @@ func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User,
func GetProtocol(r *http.Request) string {
if r.Header.Get(model.HEADER_FORWARDED_PROTO) == "https" || r.TLS != nil {
return "https"
- } else {
- return "http"
}
+ return "http"
}