From 5d00a476a6e9baf44909d93475bfad3273cf6f59 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sun, 28 Aug 2022 10:07:45 +0000 Subject: [PATCH] Redirect if user does not exist. --- routers/web/admin/users.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index aab633ec84b24..5cdfb8142ee89 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