|
@@ -19,7 +19,7 @@ class PasswordResetModal extends React.Component {
|
|
|
this.state = {
|
|
this.state = {
|
|
|
temporaryPassword: [],
|
|
temporaryPassword: [],
|
|
|
isPasswordResetDone: false,
|
|
isPasswordResetDone: false,
|
|
|
- sendEmail: false,
|
|
|
|
|
|
|
+ isEmailSent: false,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
this.resetPassword = this.resetPassword.bind(this);
|
|
this.resetPassword = this.resetPassword.bind(this);
|
|
@@ -40,12 +40,19 @@ class PasswordResetModal extends React.Component {
|
|
|
|
|
|
|
|
renderButtons() {
|
|
renderButtons() {
|
|
|
const { t, isMailerSetup } = this.props;
|
|
const { t, isMailerSetup } = this.props;
|
|
|
|
|
+ const { isEmailSent } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
- <button type="submit" className="btn btn-primary" onClick={this.onClickSendNewPasswordButton} disabled={!isMailerSetup}>
|
|
|
|
|
- {t('Send')}
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ {isEmailSent ? (
|
|
|
|
|
+ <button type="submit" className="btn btn-secondary" disabled>
|
|
|
|
|
+ {t('Done')}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <button type="submit" className="btn btn-primary" onClick={this.onClickSendNewPasswordButton} disabled={!isMailerSetup}>
|
|
|
|
|
+ {t('Send')}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ )}
|
|
|
<button type="submit" className="btn btn-danger" onClick={this.props.onClose}>
|
|
<button type="submit" className="btn btn-danger" onClick={this.props.onClose}>
|
|
|
{t('Close')}
|
|
{t('Close')}
|
|
|
</button>
|
|
</button>
|
|
@@ -150,6 +157,7 @@ class PasswordResetModal extends React.Component {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
await apiv3Put('/users/reset-password-email', { id: userForPasswordResetModal._id, newPassword: this.state.temporaryPassword });
|
|
await apiv3Put('/users/reset-password-email', { id: userForPasswordResetModal._id, newPassword: this.state.temporaryPassword });
|
|
|
|
|
+ this.setState({ isEmailSent: true });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|