Skip to content

Commit

Permalink
Redirect if user does not exist (go-gitea#20981)
Browse files Browse the repository at this point in the history
  • Loading branch information
KN4CK3R authored Aug 29, 2022
1 parent 4562d40 commit 4bd3b05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion routers/web/admin/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4bd3b05

Please sign in to comment.