diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index 9b7cdb2ea9f..7f982d7c6db 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -68,7 +68,7 @@ func ProfilePost(ctx *context.Context) { if form.Name != "" { if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureChangeUsername) { - ctx.Flash.Error(ctx.Tr("user.form.change_username_disabled")) + ctx.Flash.Error(ctx.Tr("form.change_username_disabled")) ctx.Redirect(setting.AppSubURL + "/user/settings") return } @@ -102,13 +102,13 @@ func ProfilePost(ctx *context.Context) { KeepActivityPrivate: optional.Some(form.KeepActivityPrivate), } - if form.FullName != "" { + if form.FullName != nil { if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureChangeFullName) { - ctx.Flash.Error(ctx.Tr("user.form.change_full_name_disabled")) + ctx.Flash.Error(ctx.Tr("form.change_full_name_disabled")) ctx.Redirect(setting.AppSubURL + "/user/settings") return } - opts.FullName = optional.Some(form.FullName) + opts.FullName = optional.FromPtr(form.FullName) } if err := user_service.UpdateUser(ctx, ctx.Doer, opts); err != nil { diff --git a/services/forms/user_form.go b/services/forms/user_form.go index 5f5eb8ca1f3..dda608f4946 100644 --- a/services/forms/user_form.go +++ b/services/forms/user_form.go @@ -160,8 +160,8 @@ type IntrospectTokenForm struct { // UpdateProfileForm form for updating profile type UpdateProfileForm struct { middleware.FormDefaultValidator - Name string `binding:"Username;MaxSize(40)"` - FullName string `binding:"MaxSize(100)"` + Name string `binding:"Username;MaxSize(40)"` + FullName *string `binding:"MaxSize(100)"` KeepEmailPrivate bool Website string `binding:"ValidSiteUrl;MaxSize(255)"` Location string `binding:"MaxSize(50)"`