Skip to content

Commit

Permalink
Fix administrate page limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ego008 committed May 8, 2024
1 parent 6e0f96e commit 1520848
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 13 deletions.
5 changes: 3 additions & 2 deletions controller/admin_download_cur_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/syndtr/goleveldb/leveldb/opt"
ldbUtil "github.com/syndtr/goleveldb/leveldb/util"
"github.com/valyala/fasthttp"
"goyoubbs/model"
"goyoubbs/util"
"io"
"log"
Expand All @@ -19,8 +20,8 @@ import (

func (h *BaseHandler) AdminCurDbPage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.ID == 0 {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
5 changes: 3 additions & 2 deletions controller/admin_download_img.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controller

import (
"github.com/valyala/fasthttp"
"goyoubbs/model"
"goyoubbs/util"
"log"
"os"
Expand All @@ -10,8 +11,8 @@ import (

func (h *BaseHandler) AdminImgPage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.ID == 0 {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
3 changes: 2 additions & 1 deletion controller/admin_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package controller

import (
"github.com/valyala/fasthttp"
"goyoubbs/model"
)

func (h *BaseHandler) AdminHomePage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.ID == 0 {
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
return
}
Expand Down
2 changes: 1 addition & 1 deletion controller/admin_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func (h *BaseHandler) AdminLinkPage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func (h *BaseHandler) AdminNodePage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_ratelimit_iplookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func (h *BaseHandler) AdminRateLimitIpLookup(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_ratelimit_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func (h *BaseHandler) AdminRateLimitSetting(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_site_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func (h *BaseHandler) AdminSiteConfigPage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_site_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func (h *BaseHandler) AdminSiteRouterPage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_topic_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func (h *BaseHandler) AdminTopicAddPage(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAuthor {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (h *BaseHandler) AdminUserPage(ctx *fasthttp.RequestCtx) {
func (h *BaseHandler) AdminUserPost(ctx *fasthttp.RequestCtx) {
curUser, _ := h.CurrentUser(ctx)
if curUser.Flag < model.FlagAdmin {
ctx.Redirect(h.App.Cf.Site.MainDomain+"/login", 302)
ctx.Redirect(h.App.Cf.Site.MainDomain+"/admin", 302)
return
}

Expand Down

0 comments on commit 1520848

Please sign in to comment.