'use strict'; import React from 'react'; import { History } from 'react-router'; import GlobalNotificationModel from '../../models/global_notification_model'; import GlobalNotificationActions from '../../actions/global_notification_actions'; import UserActions from '../../actions/user_actions'; import Form from './form'; import Property from './property'; import InputCheckbox from './input_checkbox'; import ApiUrls from '../../constants/api_urls'; import AscribeSpinner from '../ascribe_spinner'; import { getLangText } from '../../utils/lang_utils'; let SignupForm = React.createClass({ propTypes: { headerMessage: React.PropTypes.string, submitMessage: React.PropTypes.string, handleSuccess: React.PropTypes.func, location: React.PropTypes.object, children: React.PropTypes.oneOfType([ React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.element, React.PropTypes.string ]) }, mixins: [History], getDefaultProps() { return { headerMessage: getLangText('Welcome to ascribe'), submitMessage: getLangText('Sign up') }; }, handleSuccess(response) { if (response.user) { const notification = new GlobalNotificationModel(getLangText('Sign up successful'), 'success', 50000); GlobalNotificationActions.appendGlobalNotification(notification); // Refactor this to its own component this.props.handleSuccess(getLangText('We sent an email to your address') + ' ' + response.user.email + ', ' + getLangText('please confirm') + '.'); } else { UserActions.fetchCurrentUser(true); } }, getFormData() { const { token } = this.props.location.query; return token ? { token } : null; }, render() { const { children, headerMessage, location: { query: { email: emailQuery } }, submitMessage } = this.props; const tooltipPassword = getLangText('Your password must be at least 10 characters') + '.\n ' + getLangText('This password is securing your digital property like a bank account') + '.\n ' + getLangText('Store it in a safe place') + '!'; return (
{submitMessage} } spinner={ }>

{headerMessage}

{children} {' ' + getLangText('I agree to the Terms of Service of ascribe') + ' '} ( {getLangText('read')} )
); } }); export default SignupForm;