'use strict'; import React from 'react'; import Form from './ascribe_forms/form'; import Property from './ascribe_forms/property'; import ApiUrls from '../constants/api_urls'; import AscribeSpinner from './ascribe_spinner'; import GlobalNotificationModel from '../models/global_notification_model'; import GlobalNotificationActions from '../actions/global_notification_actions'; import { getLangText } from '../utils/lang_utils'; import { setDocumentTitle } from '../utils/dom_utils'; let PasswordResetContainer = React.createClass({ propTypes: { location: React.PropTypes.object }, getInitialState() { return {isRequested: false}; }, handleRequestSuccess(email) { this.setState({isRequested: email}); }, render() { let { location } = this.props; if (location.query.email && location.query.token) { return (
); } else { if (this.state.isRequested === false) { return (
); } else if (this.state.isRequested) { return (
{getLangText('If your email address exists in our database, you will receive a password recovery link in a few minutes.')}
); } else { return ; } } } }); let PasswordRequestResetForm = React.createClass({ propTypes: { handleRequestSuccess: React.PropTypes.func }, handleSuccess() { let notificationText = getLangText('If your email address exists in our database, you will receive a password recovery link in a few minutes.'); let notification = new GlobalNotificationModel(notificationText, 'success', 50000); GlobalNotificationActions.appendGlobalNotification(notification); this.props.handleRequestSuccess(this.refs.form.refs.email.state.value); }, render() { setDocumentTitle(getLangText('Reset your password')); return (
{getLangText('Reset your password')} } spinner={ }>

{getLangText('Reset your password')}


); } }); let PasswordResetForm = React.createClass({ propTypes: { email: React.PropTypes.string, token: React.PropTypes.string }, contextTypes: { router: React.PropTypes.object.isRequired }, getFormData() { return { email: this.props.email, token: this.props.token }; }, handleSuccess() { this.context.router.push({ pathname: '/collection' }); let notification = new GlobalNotificationModel(getLangText('password successfully updated'), 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, render() { return (
{getLangText('Reset your password')} } spinner={ }>

{getLangText('Reset the password for')} {this.props.email}


); } }); export default PasswordResetContainer;