@@ -568,26 +568,26 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
568568 redirectURL = "/"
569569 }
570570
571− p.pageWriter.WriteSignInPage(rw, req, redirectURL)
571+ p.pageWriter.WriteSignInPage(rw, req, redirectURL, code)
572572}
573573
574574// ManualSignIn handles basic auth logins to the proxy
575−func (p *OAuthProxy) ManualSignIn(req *http.Request) (string, bool) {
575+func (p *OAuthProxy) ManualSignIn(req *http.Request) (string, bool, int) {
576576 if req.Method != "POST" || p.basicAuthValidator == nil {
577− return "", false
577+ return "", false, http.StatusOK
578578 }
579579 user := req.FormValue("username")
580580 passwd := req.FormValue("password")
581581 if user == "" {
582− return "", false
582+ return "", false, http.StatusBadRequest
583583 }
584584 // check auth
585585 if p.basicAuthValidator.Validate(user, passwd) {
586586 logger.PrintAuthf(user, req, logger.AuthSuccess, "Authenticated via HtpasswdFile")
587− return user, true
587+ return user, true, http.StatusOK
588588 }
589589 logger.PrintAuthf(user, req, logger.AuthFailure, "Invalid authentication via HtpasswdFile")
590− return "", false
590+ return "", false, http.StatusUnauthorized
591591}
592592
593593// SignIn serves a page prompting users to sign in
@@ -599,7 +599,7 @@ func (p *OAuthProxy) SignIn(rw http.ResponseWriter, req *http.Request) {
599599 return
600600 }
601601
602− user, ok := p.ManualSignIn(req)
602+ user, ok, statusCode := p.ManualSignIn(req)
603603 if ok {
604604 session := &sessionsapi.SessionState{User: user, Groups: p.basicAuthGroups}
605605 err = p.SaveSession(rw, req, session)
@@ -614,7 +614,7 @@ func (p *OAuthProxy) SignIn(rw http.ResponseWriter, req *http.Request) {
614614 p.OAuthStart(rw, req)
615615 } else {
616616 // TODO - should we pass on /oauth2/sign_in query params to /oauth2/start?
617− p.SignInPage(rw, req, http.StatusOK)
617+ p.SignInPage(rw, req, statusCode)
618618 }
619619 }
620620}