aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-08-29 15:44:39 +0200
committerGitHub <noreply@github.com>2022-08-29 15:44:39 +0200
commit4bd3b05b6279ccb0a7bd165707aa2881ab90b483 (patch)
tree2d4d7f195f52d4e3481b6c466640fd214472c9a0 /routers
parent4562d40fcead66e54525f710875377ebf7c4766e (diff)
downloadgitea-4bd3b05b6279ccb0a7bd165707aa2881ab90b483.tar.gz
gitea-4bd3b05b6279ccb0a7bd165707aa2881ab90b483.zip
Redirect if user does not exist (#20981)
Diffstat (limited to 'routers')
-rw-r--r--routers/web/admin/users.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go
index aab633ec84..5cdfb8142e 100644
--- a/routers/web/admin/users.go
+++ b/routers/web/admin/users.go
@@ -209,7 +209,11 @@ func NewUserPost(ctx *context.Context) {
func prepareUserInfo(ctx *context.Context) *user_model.User {
u, err := user_model.GetUserByID(ctx.ParamsInt64(":userid"))
if err != nil {
- ctx.ServerError("GetUserByID", err)
+ if user_model.IsErrUserNotExist(err) {
+ ctx.Redirect(setting.AppSubURL + "/admin/users")
+ } else {
+ ctx.ServerError("GetUserByID", err)
+ }
return nil
}
ctx.Data["User"] = u