1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-09-05 23:34:19 -04:00

Redirect if user does not exist (#20981)

This commit is contained in:
KN4CK3R 2022-08-29 15:44:39 +02:00 committed by GitHub
parent 4562d40fce
commit 4bd3b05b62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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