Adjust behavior on empty username and token refresh

This commit is contained in:
magikstm
2018-03-11 17:30:45 -04:00
parent cd718ade49
commit db9e6df951
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -172,6 +172,11 @@ func (h *Handler) handleLogin(w http.ResponseWriter, r *http.Request) {
h.handleRefresh(w, r, userInfo)
return
}
if username == "" {
h.respondAuthFailure(w, r)
return
}
h.respondBadRequest(w, r)
return
}
+2 -2
View File
@@ -281,7 +281,7 @@ func TestHandler_Refresh_Expired(t *testing.T) {
// refreshSuccess
recorder := call(req("POST", "/context/login", "", AcceptHTML, cookieStr))
Equal(t, 400, recorder.Code)
Equal(t, 403, recorder.Code)
// verify the token from the cookie
setCookieList := readSetCookies(recorder.Header())
@@ -295,7 +295,7 @@ func TestHandler_Refresh_Invalid_Token(t *testing.T) {
// refreshSuccess
recorder := call(req("POST", "/context/login", "", AcceptHTML, cookieStr))
Equal(t, 400, recorder.Code)
Equal(t, 403, recorder.Code)
// verify the token from the cookie
setCookieList := readSetCookies(recorder.Header())