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:
parent
4651176f4d
commit
090ce2b6c3
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user