'use strict'; import React from 'react'; import Router from 'react-router'; 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'; import { getLangText } from '../utils/lang_utils'; 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 (
{getLangText('Reset the password for')} {this.props.query.email}
); } else { if (this.state.isRequested === false) { return (
{getLangText('Reset your ascribe password')}
); } else if (this.state.isRequested) { return (
{getLangText('An email has been sent to')} "{this.state.isRequested}"
); } else { return ; } } } }); let PasswordRequestResetForm = React.createClass({ handleSuccess() { let notificationText = getLangText('Request successfully 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 (
{getLangText('Reset your password')} } spinner={ }>
); } }); let PasswordResetForm = React.createClass({ mixins: [Router.Navigation], getFormData(){ return { email: this.props.email, token: this.props.token }; }, handleSuccess() { this.transitionTo('pieces'); let notification = new GlobalNotificationModel(getLangText('password successfully updated'), 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, render() { return (
{getLangText('Reset your password')} } spinner={ }>
); } }); export default PasswordResetContainer;