From d2d4c411ab5476841b2f3f24859743a6e97979b0 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 9 May 2021 14:53:05 +0800 Subject: [PATCH] Add password button. --- object/user.go | 6 ++++-- web/src/UserEditPage.js | 8 +++++--- web/src/locales/en.json | 2 ++ web/src/locales/zh.json | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/object/user.go b/object/user.go index b577f160..4088d04f 100644 --- a/object/user.go +++ b/object/user.go @@ -96,7 +96,7 @@ func UpdateUser(id string, user *User) bool { user.UpdateUserHash() - affected, err := adapter.Engine.ID(core.PK{owner, name}).AllCols().Update(user) + affected, err := adapter.Engine.ID(core.PK{owner, name}).Cols("displayName", "avatar", "affiliation", "tag", "isAdmin", "isGlobalAdmin", "isForbidden").Update(user) if err != nil { panic(err) } @@ -224,7 +224,9 @@ func GetUserField(user *User, field string) string { } func GetMaskedUser(user *User) *User { - user.Password = "***" + if user.Password != "" { + user.Password = "***" + } return user } diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index 8dbbfeb2..812320ce 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -266,9 +266,11 @@ class UserEditPage extends React.Component { {i18next.t("general:Password")}: - { - this.updateUserField('password', e.target.value); - }} /> + + + diff --git a/web/src/locales/en.json b/web/src/locales/en.json index e5a4e436..4b6ac082 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -89,6 +89,8 @@ "Upload a photo": "Upload a photo", "Select a photo...": "Select a photo...", "Set new profile picture": "Set new profile picture", + "Set password...": "Set password...", + "Modify password...": "Modify password...", "Affiliation": "Affiliation", "Tag": "Tag", "Third-party logins": "Third-party logins", diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index ea0da13c..bf310acf 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -91,6 +91,8 @@ "Upload a photo": "上传头像", "Select a photo...": "选择图片...", "Set new profile picture": "设置新头像", + "Set password...": "设置密码...", + "Modify password...": "修改密码...", "Affiliation": "工作单位", "Tag": "标签", "Third-party logins": "第三方登录",