1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-06 03:54:17 +02:00

Make register follow it's redir path.

This commit is contained in:
Aaron 2015-03-15 11:25:23 -07:00
parent 4651176f4d
commit 090ce2b6c3
2 changed files with 4 additions and 3 deletions

View File

@ -117,12 +117,12 @@ func (reg *Register) registerPostHandler(ctx *authboss.Context, w http.ResponseW
}
if authboss.IsLoaded("confirm") {
render.Redirect(ctx, w, r, "/", "Account successfully created, please verify your e-mail address.", "")
render.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "Account successfully created, please verify your e-mail address.", "")
return nil
}
ctx.SessionStorer.Put(authboss.SessionKey, key)
render.Redirect(ctx, w, r, "/", "Account successfully created, you are now logged in.", "")
render.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "Account successfully created, you are now logged in.", "")
return nil
}

View File

@ -15,6 +15,7 @@ import (
func setup() *Register {
authboss.Cfg = authboss.NewConfig()
authboss.Cfg.RegisterOKPath = "/regsuccess"
authboss.Cfg.Layout = template.Must(template.New("").Parse(`{{template "authboss" .}}`))
authboss.Cfg.XSRFName = "xsrf"
authboss.Cfg.XSRFMaker = func(_ http.ResponseWriter, _ *http.Request) string {
@ -141,7 +142,7 @@ func TestRegisterPostSuccess(t *testing.T) {
t.Error("It should have written a redirect:", w.Code)
}
if loc := w.Header().Get("Location"); loc != "/" {
if loc := w.Header().Get("Location"); loc != authboss.Cfg.RegisterOKPath {
t.Error("Redirected to the wrong location", loc)
}