mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Work on admin
This commit is contained in:
		@@ -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
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user