diff options
Diffstat (limited to 'modules/middleware/auth.go')
-rw-r--r-- | modules/middleware/auth.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index 823e457af6..2dd9b0fd98 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -109,6 +109,18 @@ func Toggle(options *ToggleOptions) macaron.Handler { } } + // Try auto-signin when not signed in. + if !ctx.IsSigned { + succeed, err := AutoSignIn(ctx) + if err != nil { + ctx.Handle(500, "AutoSignIn", err) + return + } else if succeed { + ctx.Redirect(ctx.Req.URL.Path) + return + } + } + if options.AdminRequire { if !ctx.User.IsAdmin { ctx.Error(403) |