From 090ce2b6c3dfb74fbb938908517a34179e5de068 Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 15 Mar 2015 11:25:23 -0700 Subject: [PATCH] Make register follow it's redir path. --- register/register.go | 4 ++-- register/register_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/register/register.go b/register/register.go index 4da3888..bf3f9ee 100644 --- a/register/register.go +++ b/register/register.go @@ -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 } diff --git a/register/register_test.go b/register/register_test.go index 32b3cb0..eb23713 100644 --- a/register/register_test.go +++ b/register/register_test.go @@ -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) }