From bd15a7b2deb4fe1fb3c6396517c79a5020c0f4a2 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 12 Aug 2016 18:26:59 +0200 Subject: [PATCH] Do not change page on logout --- routers/user/auth.go | 7 ++++++- templates/base/head.tmpl | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/routers/user/auth.go b/routers/user/auth.go index 40687fca6..f4ce11376 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -138,7 +138,12 @@ func SignOut(ctx *context.Context) { ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) - ctx.Redirect(setting.AppSubUrl + "/") + + if redirectTo, _ := url.QueryUnescape(ctx.Query("redirect_to")); len(redirectTo) > 0 { + ctx.Redirect(redirectTo) + } else { + ctx.Redirect(setting.AppSubUrl + "/") + } } func SignUp(ctx *context.Context) { diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 68ea47894..77122e1bd 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -122,7 +122,7 @@ {{end}}
- + {{.i18n.Tr "sign_out"}}