1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 17:45:10 +01:00
onion/js/components/ascribe_forms/form_signup.js

80 lines
3.0 KiB
JavaScript
Raw Normal View History

2015-06-11 17:22:11 +02:00
'use strict';
import React from 'react';
import apiUrls from '../../constants/api_urls';
import FormMixin from '../../mixins/form_mixin';
import InputText from './input_text';
import InputCheckbox from './input_checkbox';
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
2015-07-03 19:08:56 +02:00
import { getLangText } from '../../utils/lang_utils.js'
2015-06-11 17:22:11 +02:00
let SignupForm = React.createClass({
mixins: [FormMixin],
url() {
return apiUrls.users_signup;
},
getFormData() {
return {
email: this.refs.email.state.value,
password: this.refs.password.state.value,
password_confirm: this.refs.password_confirm.state.value,
terms: this.refs.terms.state.value,
promo_code: this.refs.promo_code.state.value
};
},
renderForm() {
return (
<form id="signup_modal_content" role="form" onSubmit={this.submit}>
<input className="invisible" type="email" name="fake_consignee"/>
<input className="invisible" type="password" name="fake_password"/>
<InputText
ref="email"
2015-07-03 19:08:56 +02:00
placeHolder={getLangText('Email')}
2015-06-11 17:22:11 +02:00
required="required"
type="email"
submitted={this.state.submitted}/>
<InputText
ref="password"
2015-07-03 19:08:56 +02:00
placeHolder={getLangText('Choose a password')}
2015-06-11 17:22:11 +02:00
required="required"
type="password"
submitted={this.state.submitted}/>
<InputText
ref="password_confirm"
2015-07-03 19:08:56 +02:00
placeHolder={getLangText('Confirm password')}
2015-06-11 17:22:11 +02:00
required="required"
type="password"
submitted={this.state.submitted}/>
<div>
2015-07-03 19:08:56 +02:00
{getLangText('Your password must be at least 10 characters')}.
{getLangText('This password is securing your digital property like a bank account')}.
{getLangText('Store it in a safe place')}!
2015-06-11 17:22:11 +02:00
</div>
<InputCheckbox
ref="terms"
required="required"
label={
<div>
2015-07-03 19:08:56 +02:00
{getLangText('I agree to the')}&nbsp;
<a href="/terms" target="_blank"> {getLangText('Terms of Service')}</a>
2015-06-15 15:28:53 +02:00
</div>}/>
2015-06-11 17:22:11 +02:00
<InputText
ref="promo_code"
2015-07-03 19:08:56 +02:00
placeHolder={getLangText('Promocode (Optional)')}
2015-06-11 17:22:11 +02:00
required=""
type="text"
submitted={this.state.submitted}/>
<ButtonSubmitOrClose
2015-07-03 19:08:56 +02:00
text={getLangText('JOIN US')}
2015-06-11 17:22:11 +02:00
onClose={this.props.onRequestHide}
submitted={this.state.submitted} />
</form>
);
}
});
export default SignupForm;