aboutsummaryrefslogtreecommitdiff
path: root/modules/middleware/auth.go
diff options
context:
space:
mode:
authorEmrah URHAN <raxetul@gmail.com>2015-11-22 19:40:18 +0200
committerEmrah URHAN <raxetul@gmail.com>2015-11-22 19:40:18 +0200
commit737da1a3748d7c82af771d3ba4aa4c76ba219eee (patch)
treeb59104944ba28771752adcc1231a847b6704ac4d /modules/middleware/auth.go
parentf63a468dfce812423b78a47cfa2583c5ad2faa49 (diff)
parentefaf60ba5a4a7c0954dbaf57203859db3258281f (diff)
Latest develop updates is merged with my RaspberryPi Dockerfile version.
Merge branch 'develop' of https://github.com/gogits/gogs into develop
Diffstat (limited to 'modules/middleware/auth.go')
-rw-r--r--modules/middleware/auth.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index 823e457a..4b953157 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 !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 {
+ ctx.Redirect(setting.AppSubUrl + ctx.Req.RequestURI)
+ return
+ }
+ }
+
if options.AdminRequire {
if !ctx.User.IsAdmin {
ctx.Error(403)