1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Refactor login and signup

This commit is contained in:
vrde 2015-07-13 20:47:43 +02:00
parent 3f0cdbad06
commit 7aea6669c9
5 changed files with 24 additions and 13 deletions

View File

@ -17,6 +17,12 @@ import { getLangText } from '../../utils/lang_utils';
let RegisterPieceForm = React.createClass({
propTypes: {
handleSuccess: React.PropTypes.func,
isFineUploaderEditable: React.PropTypes.bool,
children: React.PropTypes.element
},
getInitialState(){
return {
digitalWorkKey: null,

View File

@ -23,7 +23,8 @@ let SignupForm = React.createClass({
propTypes: {
headerMessage: React.PropTypes.string,
submitMessage: React.PropTypes.string,
handleSuccess: React.PropTypes.func
handleSuccess: React.PropTypes.func,
children: React.PropTypes.element
},
mixins: [Router.Navigation],
@ -120,13 +121,7 @@ let SignupForm = React.createClass({
autoComplete="on"
required/>
</Property>
<Property
name='promo_code'
label={getLangText('Promocode')}>
<input
type="text"
placeholder={getLangText('Enter a promocode here (Optional)')}/>
</Property>
{this.props.children}
<Property
name="terms"
className="ascribe-settings-property-collapsible-toggle"
@ -138,4 +133,5 @@ let SignupForm = React.createClass({
}
});
export default SignupForm;

View File

@ -27,7 +27,6 @@ import SlidesContainer from './ascribe_slides_container/slides_container';
import { mergeOptions } from '../utils/general_utils';
import { getCookie } from '../utils/fetch_api_utils';
import { getLangText } from '../utils/lang_utils';
let RegisterPiece = React.createClass( {

View File

@ -2,8 +2,10 @@
import React from 'react';
import SignupForm from './ascribe_forms/form_signup';
import Property from './ascribe_forms/property';
import { getLangText } from '../utils/lang_utils';
// import { getLangText } from '../utils/lang_utils';
let SignupContainer = React.createClass({
getInitialState() {
@ -33,8 +35,15 @@ let SignupContainer = React.createClass({
}
return (
<div className="ascribe-login-wrapper">
<br/>
<SignupForm handleSuccess={this.handleSuccess}/>
<SignupForm>
<Property
name='promo_code'
label={getLangText('Promocode')}>
<input
type="text"
placeholder={getLangText('Enter a promocode here (Optional)')}/>
</Property>
</SignupForm>
</div>
);
}

View File

@ -22,6 +22,7 @@ function getRoutes(commonRoutes) {
<Route name="login" path="login" handler={LoginContainer} />
<Route name="signup" path="signup" handler={SignupContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
<Route name="register_piece" path="register_piece" handler={RegisterPiece} />
</Route>
);
}