Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
- move resetCodeSent mesage and hide button #1878
Browse files Browse the repository at this point in the history
- fix props error
  • Loading branch information
siemiatj committed Aug 8, 2018
1 parent e959535 commit a0eec3c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
4 changes: 4 additions & 0 deletions src/assets/css/inputs.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ input {
white-space: nowrap;
overflow: hidden;
margin: 0;

&.instruction-sent {
white-space: normal;
}
}

.form-group {
Expand Down
53 changes: 27 additions & 26 deletions src/components/app/PasswordRecovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,17 @@ class PasswordRecovery extends Component {
};

renderForgottenPasswordForm = () => {
const { pending, err } = this.state;
const { pending, err, resetEmailSent } = this.state;

if (resetEmailSent) {
return (
<div>
<div className="form-control-label instruction-sent">
{counterpart.translate('forgotPassword.resetCodeSent.caption')}
</div>
</div>
);
}

return (
<div>
Expand Down Expand Up @@ -238,21 +248,9 @@ class PasswordRecovery extends Component {
const { token } = this.props;
const { pending, resetEmailSent, avatarSrc, form } = this.state;
const resetPassword = token ? true : false;
let buttonMessage = counterpart.translate(
'forgotPassword.changePassword.caption'
);

if (!resetPassword) {
if (resetEmailSent) {
buttonMessage = counterpart.translate(
'forgotPassword.resetCodeSent.caption'
);
} else {
buttonMessage = counterpart.translate(
'forgotPassword.sendResetCode.caption'
);
}
}
let buttonMessage = resetPassword
? counterpart.translate('forgotPassword.changePassword.caption')
: counterpart.translate('forgotPassword.sendResetCode.caption');

return (
<div
Expand All @@ -279,15 +277,18 @@ class PasswordRecovery extends Component {
{!resetEmailSent && resetPassword
? this.renderResetPasswordForm()
: this.renderForgottenPasswordForm()}
<div className="mt-2">
<button
className="btn btn-sm btn-block btn-meta-success"
disabled={pending}
type="submit"
>
{buttonMessage}
</button>
</div>

{!resetEmailSent && (
<div className="mt-2">
<button
className="btn btn-sm btn-block btn-meta-success"
disabled={pending}
type="submit"
>
{buttonMessage}
</button>
</div>
)}
</form>
</div>
);
Expand All @@ -298,7 +299,7 @@ PasswordRecovery.propTypes = {
dispatch: PropTypes.func.isRequired,
path: PropTypes.string.isRequired,
token: PropTypes.string,
onResetOk: PropTypes.bool,
onResetOk: PropTypes.func,
};

export default connect()(PasswordRecovery);

0 comments on commit a0eec3c

Please sign in to comment.