diff options
author | Unknwon <u@gogs.io> | 2016-03-03 15:09:43 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-03 15:09:43 -0500 |
commit | f946040fa94a3acb3b1f54873e6f95766595829c (patch) | |
tree | 4f7105c0554bc65763b411c1c032e9196272673e /modules/middleware/auth.go | |
parent | 434614506e7edee8d75d747dfe2ac59458f669fe (diff) | |
download | gitea-f946040fa94a3acb3b1f54873e6f95766595829c.tar.gz gitea-f946040fa94a3acb3b1f54873e6f95766595829c.zip |
#1891 attempt to fix expected invalid CSRF token
- Remove unused config settings `[picture] service`
Diffstat (limited to 'modules/middleware/auth.go')
-rw-r--r-- | modules/middleware/auth.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index 5c470d9a70..e7460fc6dd 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -109,17 +109,11 @@ func Toggle(options *ToggleOptions) macaron.Handler { } } - // Try auto-signin when not signed in. - if !options.SignOutRequire && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) { - succeed, err := AutoSignIn(ctx) - if err != nil { - ctx.Handle(500, "AutoSignIn", err) - return - } else if succeed { - log.Trace("Auto-login succeed: %s", ctx.Session.Get("uname")) - ctx.Redirect(setting.AppSubUrl + ctx.Req.RequestURI) - return - } + // Auto-signin info is provided and has not signed in. + if !options.SignOutRequire && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) && + len(ctx.GetCookie(setting.CookieUserName)) > 0 { + ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) + ctx.Redirect(setting.AppSubUrl + ctx.Req.RequestURI) } if options.AdminRequire { |