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

Commit

Permalink
- handle password reset errors (nonexisting email) #1878
Browse files Browse the repository at this point in the history
  • Loading branch information
siemiatj committed Aug 7, 2018
1 parent 6d5a24e commit 6237019
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/app/PasswordRecovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class PasswordRecovery extends Component {
}

handleKeyPress = e => {
console.log('keypressed: ', e.key)
// console.log('keypressed: ', e.key)
// if (e.key === 'Enter') {
// this.handleLogin();
// }
Expand All @@ -50,8 +50,6 @@ export default class PasswordRecovery extends Component {
const { form } = this.state;
const resetPassword = path === 'resetPassword' ? true : false;

console.log('submit');

this.setState(
{
pending: true,
Expand All @@ -63,8 +61,7 @@ export default class PasswordRecovery extends Component {
console.log('response from reset !: ', response);
})
.catch(error => {
console.log('ERROR ! ', error)
this.setState({ err: error.message });
this.setState({ err: error.data.message, pending: false });
});
}
);
Expand Down Expand Up @@ -154,10 +151,11 @@ export default class PasswordRecovery extends Component {
// };

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

return (
<div>
{err && <div className="input-error">{err}</div>}
<div>
<div className="form-control-label">
<small>
Expand All @@ -169,6 +167,7 @@ export default class PasswordRecovery extends Component {
name="email"
onChange={e => this.handleChange(e, 'email')}
className={classnames('input-primary input-block', {
'input-error': err,
'input-disabled': pending,
})}
disabled={pending}
Expand Down
5 changes: 5 additions & 0 deletions src/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export default class App extends Component {
}
}

//reset password errors
if (error.response.request.responseURL.includes('resetPassword')) {
return Promise.reject(error.response);
}

if (error.response.request.responseURL.includes('showError=true')) {
const { data } = error.response;

Expand Down

0 comments on commit 6237019

Please sign in to comment.