diff --git a/src/client.js b/src/client.js index b775ab5..6c5e912 100644 --- a/src/client.js +++ b/src/client.js @@ -74,6 +74,7 @@ const rootRoute = { require('./routes/500'), require('./routes/confirmEmail'), require('./routes/forgotPassword'), + require('./routes/resetPassword'), require('./routes/lockScreen'), require('./routes/login'), require('./routes/signUp'), diff --git a/src/routes/forgotPassword/components/ForgotPassword.js b/src/routes/forgotPassword/components/ForgotPassword.js index 13ecee5..d1c0184 100644 --- a/src/routes/forgotPassword/components/ForgotPassword.js +++ b/src/routes/forgotPassword/components/ForgotPassword.js @@ -36,7 +36,7 @@ class ForgotPassowrd extends React.Component {
- Reset + Reset
diff --git a/src/routes/resetPassword/components/ResetPassword.js b/src/routes/resetPassword/components/ResetPassword.js new file mode 100644 index 0000000..8218738 --- /dev/null +++ b/src/routes/resetPassword/components/ResetPassword.js @@ -0,0 +1,130 @@ +import React from 'react'; +import TextField from 'material-ui/TextField'; +import QueueAnim from 'rc-queue-anim'; +import RaisedButton from 'material-ui/RaisedButton'; + +class ResetPassowrd extends React.Component { + constructor() { + super(); + this.state = { + validated:false, + }; + + this.buttonValidated = this.buttonValidated.bind(this); + this.handlePass = this.handlePass.bind(this); + this.handleConfirmationPass = this.handleConfirmationPass.bind(this); + this.clickEvent = this.clickEvent.bind(this); + } + + buttonValidated = () => { + let validated = true; + if (!this.state.password_validated || !this.state.pass || this.state.pass === null || this.state.pass === "") validated = false; + + this.setState(Object.assign(this.state, { validated: validated })); + } + + handlePass = (event) => { + this.setState(Object.assign(this.state, { pass: btoa(event.target.value) })); + this.setState(Object.assign(this.state, { password_validated: this.state.pass === this.state.passConfirmation })); + }; + + handleConfirmationPass = (event) => { + this.setState(Object.assign(this.state, { passConfirmation: btoa(event.target.value) })); + this.setState(Object.assign(this.state, { password_validated: this.state.pass === this.state.passConfirmation })); + }; + + 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) { + 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); + }); + */ + } + + + render() { + return ( +
+
+
+
+

Reset Password

+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+ ); + } +} + +const Page = () => ( +
+
+ +
+ +
+
+
+
+); + +module.exports = Page; + diff --git a/src/routes/resetPassword/index.js b/src/routes/resetPassword/index.js new file mode 100644 index 0000000..80ee4c1 --- /dev/null +++ b/src/routes/resetPassword/index.js @@ -0,0 +1,8 @@ +module.exports = { + path: 'reset-password', + getComponent(nextState, cb) { + require.ensure([], (require) => { + cb(null, require('./components/ResetPassword')); + }); + } +};