mirror of
https://github.com/go-gitea/gitea
synced 2024-11-19 00:11:24 +01:00
parent
bd7de0c4e4
commit
a129c0c06c
2 changed files with 19 additions and 2 deletions
|
@ -567,6 +567,8 @@ enterred_invalid_repo_name = The repository name you entered is incorrect.
|
||||||
enterred_invalid_org_name = The organization name you entered is incorrect.
|
enterred_invalid_org_name = The organization name you entered is incorrect.
|
||||||
enterred_invalid_owner_name = The new owner name is not valid.
|
enterred_invalid_owner_name = The new owner name is not valid.
|
||||||
enterred_invalid_password = The password you entered is incorrect.
|
enterred_invalid_password = The password you entered is incorrect.
|
||||||
|
unset_password = The login user has not set the password.
|
||||||
|
unsupported_login_type = The login type is not supported to delete account.
|
||||||
user_not_exist = The user does not exist.
|
user_not_exist = The user does not exist.
|
||||||
team_not_exist = The team does not exist.
|
team_not_exist = The team does not exist.
|
||||||
last_org_owner = You cannot remove the last user from the 'owners' team. There must be at least one owner for an organization.
|
last_org_owner = You cannot remove the last user from the 'owners' team. There must be at least one owner for an organization.
|
||||||
|
|
|
@ -19,6 +19,8 @@ import (
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
"code.gitea.io/gitea/services/auth"
|
"code.gitea.io/gitea/services/auth"
|
||||||
|
"code.gitea.io/gitea/services/auth/source/db"
|
||||||
|
"code.gitea.io/gitea/services/auth/source/smtp"
|
||||||
"code.gitea.io/gitea/services/forms"
|
"code.gitea.io/gitea/services/forms"
|
||||||
"code.gitea.io/gitea/services/mailer"
|
"code.gitea.io/gitea/services/mailer"
|
||||||
"code.gitea.io/gitea/services/user"
|
"code.gitea.io/gitea/services/user"
|
||||||
|
@ -236,11 +238,24 @@ func DeleteAccount(ctx *context.Context) {
|
||||||
ctx.Data["PageIsSettingsAccount"] = true
|
ctx.Data["PageIsSettingsAccount"] = true
|
||||||
|
|
||||||
if _, _, err := auth.UserSignIn(ctx, ctx.Doer.Name, ctx.FormString("password")); err != nil {
|
if _, _, err := auth.UserSignIn(ctx, ctx.Doer.Name, ctx.FormString("password")); err != nil {
|
||||||
if user_model.IsErrUserNotExist(err) {
|
switch {
|
||||||
|
case user_model.IsErrUserNotExist(err):
|
||||||
|
loadAccountData(ctx)
|
||||||
|
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.user_not_exist"), tplSettingsAccount, nil)
|
||||||
|
case errors.Is(err, smtp.ErrUnsupportedLoginType):
|
||||||
|
loadAccountData(ctx)
|
||||||
|
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.unsupported_login_type"), tplSettingsAccount, nil)
|
||||||
|
case errors.As(err, &db.ErrUserPasswordNotSet{}):
|
||||||
|
loadAccountData(ctx)
|
||||||
|
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.unset_password"), tplSettingsAccount, nil)
|
||||||
|
case errors.As(err, &db.ErrUserPasswordInvalid{}):
|
||||||
loadAccountData(ctx)
|
loadAccountData(ctx)
|
||||||
|
|
||||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), tplSettingsAccount, nil)
|
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), tplSettingsAccount, nil)
|
||||||
} else {
|
default:
|
||||||
ctx.ServerError("UserSignIn", err)
|
ctx.ServerError("UserSignIn", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue