comparison pkg/controllers/token.go @ 425:c49f4c1808b1

Simplified user validation with new UserName type.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 16 Aug 2018 17:31:25 +0200
parents c70ddc6eb168
children fc37e7072022
comparison
equal deleted inserted replaced
424:abe4efa339bc 425:c49f4c1808b1
61 var ( 61 var (
62 user = req.FormValue("user") 62 user = req.FormValue("user")
63 password = req.FormValue("password") 63 password = req.FormValue("password")
64 ) 64 )
65 65
66 if user == "" || !UserName(user).isValid() || password == "" { 66 if !UserName(user).isValid() || password == "" {
67 http.Error(rw, "Invalid credentials", http.StatusBadRequest) 67 http.Error(rw, "Invalid credentials", http.StatusBadRequest)
68 return 68 return
69 } 69 }
70 70
71 token, session, err := auth.GenerateSession(user, password) 71 token, session, err := auth.GenerateSession(user, password)