mirror of https://github.com/go-gitea/gitea.git
Use correct translation key for errors (#18342)
- Noted by: https://github.com/go-gitea/gitea/issues/17876#issuecomment-1017503614
This commit is contained in:
parent
5bf8d5445e
commit
16d378fefc
|
@ -74,10 +74,14 @@ func SettingsPost(ctx *context.Context) {
|
||||||
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form)
|
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form)
|
||||||
return
|
return
|
||||||
} else if err = user_model.ChangeUserName(org.AsUser(), form.Name); err != nil {
|
} else if err = user_model.ChangeUserName(org.AsUser(), form.Name); err != nil {
|
||||||
if db.IsErrNameReserved(err) || db.IsErrNamePatternNotAllowed(err) {
|
switch {
|
||||||
|
case db.IsErrNameReserved(err):
|
||||||
ctx.Data["OrgName"] = true
|
ctx.Data["OrgName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.illegal_username"), tplSettingsOptions, &form)
|
ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(db.ErrNameReserved).Name), tplSettingsOptions, &form)
|
||||||
} else {
|
case db.IsErrNamePatternNotAllowed(err):
|
||||||
|
ctx.Data["OrgName"] = true
|
||||||
|
ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(db.ErrNamePatternNotAllowed).Pattern), tplSettingsOptions, &form)
|
||||||
|
default:
|
||||||
ctx.ServerError("ChangeUserName", err)
|
ctx.ServerError("ChangeUserName", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue