Skip to content
This repository was archived by the owner on Jun 10, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import './shared/styles/react-select.global.css';
import './shared/styles/notifications.global.css';
import './index.css';

Raven.config('https://6350058c0b0247bf8923b9965ca744fa@sentry.io/222621').install();
Raven.config('https://6350058c0b0247bf8923b9965ca744fa@sentry.io/222621', {
environment: process.env.NODE_ENV
}).install();

ReactDOM.render(<App />, document.getElementById('root'));
11 changes: 9 additions & 2 deletions src/scenes/home/resetPassword/requestToken/requestToken.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import axios from 'axios';
import Raven from 'raven-js';
import { Redirect } from 'react-router-dom';
import Form from 'shared/components/form/form';
import FormEmail from 'shared/components/form/formEmail/formEmail';
Expand Down Expand Up @@ -27,13 +28,19 @@ class RequestToken extends Component {
e.preventDefault();
if (this.isFormValid()) {
axios
.post(`${config.apiUrl}/users/passwords/reset`, {
.post(`${config.apiUrl}/users/passwords/forgot`, {
email: this.state.email
})
.then(() => {
this.setState({ success: true, error: null });
})
.catch(() => {
.catch((err) => {
Raven.setUserContext({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't actually be necessary, as raven catches all exceptions, but i'll leave it cuz maybe context is helpful

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context was the only reason I put this in here.

email: this.state.email,
action: 'Attemped password reset'
});
Raven.captureException(err);
Raven.setUserContext();
this.setState({ error: 'We were unable to reset the password for this email' });
});
}
Expand Down
18 changes: 9 additions & 9 deletions src/scenes/home/resetPassword/setPassword/setPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ class RequestToken extends Component {
handleOnClick = (e) => {
e.preventDefault();
if (this.isFormValid()) {
axios.post(`${config.apiUrl}/users/password`, {
user: {
axios
.post(`${config.apiUrl}/users/passwords/reset`, {
reset_password_token: this.props.resetPasswordToken,
password: this.state.password
}
}).then(() => {
this.setState({ success: true, error: null });
}).catch(() => {
this.setState({ error: 'We were unable to set the password for this email' });
});
})
.then(() => {
this.setState({ success: true, error: null });
})
.catch(() => {
this.setState({ error: 'Error: please email staff@operationcode.org for help' });
});
}
};

isFormValid = () => this.state.passwordValid && this.state.passwordConfirmValid;

render() {
Expand Down