forked from forgejo/forgejo
Work on admin
This commit is contained in:
parent
5cb2d3d2e2
commit
9f9cd6bfc6
19 changed files with 177 additions and 41 deletions
|
@ -20,7 +20,7 @@ func SignInRequire(redirect bool) martini.Handler {
|
|||
return
|
||||
} else if !ctx.User.IsActive && base.Service.RegisterEmailConfirm {
|
||||
ctx.Data["Title"] = "Activate Your Account"
|
||||
ctx.Render.HTML(200, "user/active", ctx.Data)
|
||||
ctx.HTML(200, "user/active")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,18 @@ func SignOutRequire() martini.Handler {
|
|||
return func(ctx *Context) {
|
||||
if ctx.IsSigned {
|
||||
ctx.Redirect("/")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AdminRequire requires user signed in as administor.
|
||||
func AdminRequire() martini.Handler {
|
||||
return func(ctx *Context) {
|
||||
if ctx.User.LowerName != base.AdminName && !ctx.User.IsAdmin {
|
||||
ctx.Error(403)
|
||||
return
|
||||
}
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue