diff --git a/src/client.js b/src/client.js index 6c5e912..68a92e4 100644 --- a/src/client.js +++ b/src/client.js @@ -33,8 +33,8 @@ const isFunction = (functionToCheck) => { }; const requireAuth = (nextState, replace, next) => { - if (nextState.location.pathname === '/login' || nextState.location.pathname === '/sign-up' || nextState.location.pathname.toLowerCase() === '/selfregister' || (nextState.location.pathname.indexOf('/ride') > -1 && nextState.params.ride_uuid !== undefined && nextState.params.user_uuid !== undefined) - || (!isFunction(replace) && (replace.location.pathname === '/login' || replace.location.pathname === '/sign-up' || nextState.location.pathname.toLowerCase() === '/selfRegister' || (replace.location.pathname.indexOf('/ride') > -1 && replace.params.ride_uuid !== undefined && replace.params.user_uuid !== undefined)))) { + if (nextState.location.pathname === '/login' || nextState.location.pathname === '/sign-up' || nextState.location.pathname.toLowerCase() === '/selfregister' || (nextState.location.pathname.indexOf('/reset-password') > -1 && nextState.params.token !== undefined) || (nextState.location.pathname.indexOf('/ride') > -1 && nextState.params.ride_uuid !== undefined && nextState.params.user_uuid !== undefined) + || (!isFunction(replace) && (replace.location.pathname === '/login' || replace.location.pathname === '/sign-up' || nextState.location.pathname.toLowerCase() === '/selfRegister' || (replace.location.pathname.indexOf('/reset-password') > -1 && replace.params.token !== undefined) || (replace.location.pathname.indexOf('/ride') > -1 && replace.params.ride_uuid !== undefined && replace.params.user_uuid !== undefined)))) { next(); } diff --git a/src/routes/forgotPassword/components/ForgotPassword.js b/src/routes/forgotPassword/components/ForgotPassword.js index d1c0184..ef0d936 100644 --- a/src/routes/forgotPassword/components/ForgotPassword.js +++ b/src/routes/forgotPassword/components/ForgotPassword.js @@ -2,13 +2,33 @@ import React from 'react'; import APPCONFIG from 'constants/Config'; import TextField from 'material-ui/TextField'; import QueueAnim from 'rc-queue-anim'; +import RaisedButton from 'material-ui/RaisedButton'; +import Instance from '../../../components/Connection'; class ForgotPassowrd extends React.Component { constructor() { super(); this.state = { - brand: APPCONFIG.brand + brand: APPCONFIG.brand, + email: '', }; + + this.handleEmail = this.handleEmail.bind(this); + } + + handleEmail = (event) => { + this.setState(Object.assign(this.state, { email: event.target.value })); + }; + + clickEvent = (event) => { + event.preventDefault(); + + Instance.setToken(null).post('/v1/passwordreset/request/' + this.state.email).then(function (res) { + location.href = '/#/confirm-email'; + }).catch(function (err) { + location.href = '/#/confirm-email'; + }); + } render() { @@ -24,6 +44,7 @@ class ForgotPassowrd extends React.Component {