work on #1891
This commit is contained in:
parent
915bf1d2e3
commit
9330c943cd
4 changed files with 16 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue