mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 21:35:35 +03:00
Redirect if user does not exist (#20981)
This commit is contained in:
parent
4562d40fce
commit
4bd3b05b62
1 changed files with 5 additions and 1 deletions
|
@ -209,7 +209,11 @@ func NewUserPost(ctx *context.Context) {
|
||||||
func prepareUserInfo(ctx *context.Context) *user_model.User {
|
func prepareUserInfo(ctx *context.Context) *user_model.User {
|
||||||
u, err := user_model.GetUserByID(ctx.ParamsInt64(":userid"))
|
u, err := user_model.GetUserByID(ctx.ParamsInt64(":userid"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if user_model.IsErrUserNotExist(err) {
|
||||||
|
ctx.Redirect(setting.AppSubURL + "/admin/users")
|
||||||
|
} else {
|
||||||
ctx.ServerError("GetUserByID", err)
|
ctx.ServerError("GetUserByID", err)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ctx.Data["User"] = u
|
ctx.Data["User"] = u
|
||||||
|
|
Loading…
Reference in a new issue