handle sign in directly (if using htpasswd)

This commit is contained in:
Jehiah Czebotar 2012-12-26 10:35:02 -05:00
parent 4367e47a46
commit c97de52200

View File

@ -201,19 +201,19 @@ func (p *OauthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
p.ClearCookie(rw, req) p.ClearCookie(rw, req)
rw.WriteHeader(code) rw.WriteHeader(code)
templates := getTemplates() templates := getTemplates()
t := struct{ t := struct {
SignInMessage string SignInMessage string
Htpasswd bool Htpasswd bool
}{ }{
SignInMessage: p.SignInMessage, SignInMessage: p.SignInMessage,
Htpasswd: p.HtpasswdFile != nil, Htpasswd: p.HtpasswdFile != nil,
} }
templates.ExecuteTemplate(rw, "sign_in.html", t) templates.ExecuteTemplate(rw, "sign_in.html", t)
} }
func (p *OauthProxy) ManualSignIn(rw http.ResponseWriter, req *http.Request) (string, bool){ func (p *OauthProxy) ManualSignIn(rw http.ResponseWriter, req *http.Request) (string, bool) {
if req.Method != "POST" || p.HtpasswdFile == nil{ if req.Method != "POST" || p.HtpasswdFile == nil {
return "", false return "", false
} }
user := req.FormValue("username") user := req.FormValue("username")
@ -236,7 +236,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
remoteIP = req.RemoteAddr remoteIP = req.RemoteAddr
} }
log.Printf("%s %s %s", remoteIP, req.Method, req.URL.Path) log.Printf("%s %s %s", remoteIP, req.Method, req.URL.Path)
var ok bool var ok bool
var user string var user string
if req.URL.Path == signInPath { if req.URL.Path == signInPath {