diff --git a/src/index.js b/src/index.js index 722419881..8aeeaa884 100644 --- a/src/index.js +++ b/src/index.js @@ -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(, document.getElementById('root')); diff --git a/src/scenes/home/resetPassword/requestToken/requestToken.js b/src/scenes/home/resetPassword/requestToken/requestToken.js index ae06611e4..a4f04f9fd 100644 --- a/src/scenes/home/resetPassword/requestToken/requestToken.js +++ b/src/scenes/home/resetPassword/requestToken/requestToken.js @@ -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'; @@ -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({ + 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' }); }); } diff --git a/src/scenes/home/resetPassword/setPassword/setPassword.js b/src/scenes/home/resetPassword/setPassword/setPassword.js index a67b67af5..7b94c4bf0 100644 --- a/src/scenes/home/resetPassword/setPassword/setPassword.js +++ b/src/scenes/home/resetPassword/setPassword/setPassword.js @@ -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() {