Add password button.

This commit is contained in:
Yang Luo 2021-05-09 14:53:05 +08:00
parent efab90ef3f
commit d2d4c411ab
4 changed files with 13 additions and 5 deletions

View File

@ -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
}

View File

@ -266,9 +266,11 @@ class UserEditPage extends React.Component {
{i18next.t("general:Password")}:
</Col>
<Col span={22} >
<Input value={this.state.user.password} onChange={e => {
this.updateUserField('password', e.target.value);
}} />
<Row>
<Button type="default">
{this.state.user.password === "" ? i18next.t("user:Set password...") : i18next.t("user:Modify password...")}
</Button>
</Row>
</Col>
</Row>
<Row style={{marginTop: '20px'}} >

View File

@ -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",

View File

@ -91,6 +91,8 @@
"Upload a photo": "上传头像",
"Select a photo...": "选择图片...",
"Set new profile picture": "设置新头像",
"Set password...": "设置密码...",
"Modify password...": "修改密码...",
"Affiliation": "工作单位",
"Tag": "标签",
"Third-party logins": "第三方登录",