diff --git a/js/components/login_container.js b/js/components/login_container.js index 9e6dd10a..a589a3ec 100644 --- a/js/components/login_container.js +++ b/js/components/login_container.js @@ -14,6 +14,7 @@ import Property from './ascribe_forms/property'; import apiUrls from '../constants/api_urls'; import AppConstants from '../constants/application_constants'; +let Link = Router.Link; let LoginContainer = React.createClass({ mixins: [Router.Navigation], @@ -46,7 +47,6 @@ let LoginContainer = React.createClass({
Log in to ascribe...
- ); @@ -108,8 +108,8 @@ let LoginForm = React.createClass({
- Not an ascribe user? Sign up...
- Forgot my password? Rescue me... + Not an ascribe user? Sign up...
+ Forgot my password? Rescue me...
); diff --git a/js/components/password_reset_container.js b/js/components/password_reset_container.js index 2df20ef0..5098a7ad 100644 --- a/js/components/password_reset_container.js +++ b/js/components/password_reset_container.js @@ -3,28 +3,160 @@ import React from 'react'; import Router from 'react-router'; -import PasswordResetForm from './ascribe_forms/form_password_reset'; +import Form from './ascribe_forms/form'; +import Property from './ascribe_forms/property'; + +import apiUrls from '../constants/api_urls'; import GlobalNotificationModel from '../models/global_notification_model'; import GlobalNotificationActions from '../actions/global_notification_actions'; let PasswordResetContainer = React.createClass({ mixins: [Router.Navigation], + getInitialState() { + return {isRequested: false}; + }, + handleRequestSuccess(email){ + this.setState({isRequested: email}); + }, + render() { + if (this.props.query.email && this.props.query.token) { + return ( +
+
+ Reset the password for {this.props.query.email} +
+ +
+ ); + } + else { + if (this.state.isRequested === false) { + return ( +
+
+ Reset your ascribe password +
+ +
+ ); + } + else if (this.state.isRequested) { + return ( +
+
+ An email has been sent to "{this.state.isRequested}" +
+
+ ); + } + else { + return ; + } + } + } +}); - handleSuccess(){ +let PasswordRequestResetForm = React.createClass({ + handleSuccess() { + let notificationText = 'Request succesfully sent, check your email'; + let notification = new GlobalNotificationModel(notificationText, 'success', 50000); + GlobalNotificationActions.appendGlobalNotification(notification); + this.props.handleRequestSuccess(this.refs.form.refs.email.state.value); + }, + render() { + return ( +
+ Reset your password + } + spinner={ + + }> + + + +
+
+ ); + } +}); + +let PasswordResetForm = React.createClass({ + mixins: [Router.Navigation], + + getFormData(){ + let data = {}; + for (let ref in this.refs.form.refs){ + data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value; + } + data.digital_work_key = this.state.digitalWorkKey; + data.email = this.props.email; + data.token = this.props.token; + return data; + }, + handleSuccess() { this.transitionTo('pieces'); let notification = new GlobalNotificationModel('password succesfully updated', 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, render() { return ( - - ); - } + getFormData={this.getFormData} + buttons={ + } + spinner={ + + }> + + + + + + +
+ + ); + } }); export default PasswordResetContainer; \ No newline at end of file