handle reset confirmation page
This commit is contained in:
@@ -2,12 +2,17 @@ import React from 'react';
|
||||
import TextField from 'material-ui/TextField';
|
||||
import QueueAnim from 'rc-queue-anim';
|
||||
import RaisedButton from 'material-ui/RaisedButton';
|
||||
import Instance from '../../../components/Connection';
|
||||
|
||||
class ResetPassowrd extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
validated:false,
|
||||
token:'',
|
||||
pass:'',
|
||||
passConfirmation:'',
|
||||
password_validated:false,
|
||||
};
|
||||
|
||||
this.buttonValidated = this.buttonValidated.bind(this);
|
||||
@@ -34,41 +39,38 @@ class ResetPassowrd extends React.Component {
|
||||
};
|
||||
|
||||
clickEvent = (event) => {
|
||||
location.href = '/#/login';
|
||||
/*
|
||||
event.preventDefault();
|
||||
const state = this;
|
||||
|
||||
let user = {
|
||||
"provider":
|
||||
{
|
||||
"org_name": this.state.provider_name,
|
||||
"internal_id": this.state.provider_npi
|
||||
},
|
||||
"name": this.state.first + ' ' + this.state.last,
|
||||
"first": this.state.first,
|
||||
"last": this.state.last,
|
||||
"email": this.state.email,
|
||||
"phonenumber": this.state.phone_number,
|
||||
"pass": this.state.pass,
|
||||
};
|
||||
|
||||
Instance.setToken(null).post('/v1/selfregister/', user).then(function (res) {
|
||||
Instance.setToken(null).post('/v1/passworddreset/complete' + state.state.token, user).then(function (res) {
|
||||
localStorage.removeItem('loggedUser');
|
||||
location.href = '/#/login';
|
||||
}).catch(function (err) {
|
||||
if (err.response.status === 422) {
|
||||
//Unprocessable Entity (validation failed)
|
||||
state.setState(Object.assign(state.state, {
|
||||
showValidationErrors: true,
|
||||
validationErrors: err.response.data.data
|
||||
}));
|
||||
} else {
|
||||
alert('Error to log in: ' + err.message);
|
||||
}
|
||||
console.error(err);
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
componentWillMount(){
|
||||
let urlParts = location.href.split('/');
|
||||
let token = urlParts[urlParts.length - 1];
|
||||
if (token.length < 1) {
|
||||
token = urlParts[urlParts.length - 2]
|
||||
}
|
||||
|
||||
let state = this;
|
||||
|
||||
|
||||
Instance.setToken(null).post('/v1/passwordreset/open/' + token).then(res=>{
|
||||
state.setState(Object.assign(state.state, {
|
||||
token:token
|
||||
}));
|
||||
}).catch(err=>{
|
||||
location.href = '/#/404';
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
path: 'reset-password',
|
||||
path: 'reset-password/:token',
|
||||
getComponent(nextState, cb) {
|
||||
require.ensure([], (require) => {
|
||||
cb(null, require('./components/ResetPassword'));
|
||||
|
||||
Reference in New Issue
Block a user