Admin can reset password without old password.

This commit is contained in:
Gucheng Wang
2021-12-12 19:15:24 +08:00
parent e0b7286882
commit 29807b82e1
2 changed files with 3 additions and 2 deletions

View File

@ -25,6 +25,7 @@ export const PasswordModal = (props) => {
const [newPassword, setNewPassword] = React.useState("");
const [rePassword, setRePassword] = React.useState("");
const {user} = props;
const {account} = props;
const showModal = () => {
setVisible(true);
@ -73,7 +74,7 @@ export const PasswordModal = (props) => {
width={600}
>
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
{ hasOldPassword ? (
{ (hasOldPassword && !Setting.isAdminUser(account)) ? (
<Row style={{width: "100%", marginBottom: "20px"}}>
<Input.Password addonBefore={i18next.t("user:Old Password")} placeholder={i18next.t("user:input password")} onChange={(e) => setOldPassword(e.target.value)}/>
</Row>

View File

@ -202,7 +202,7 @@ class UserEditPage extends React.Component {
{Setting.getLabel(i18next.t("general:Password"), i18next.t("general:Password - Tooltip"))} :
</Col>
<Col span={22} >
<PasswordModal user={this.state.user} />
<PasswordModal user={this.state.user} account={this.props.account} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >