1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

refactor login form

This commit is contained in:
Tim Daubenschütz 2015-07-10 16:34:34 +02:00
parent e55bc239b4
commit b6048a7f91

View File

@ -11,6 +11,7 @@ import UserActions from '../actions/user_actions';
import Form from './ascribe_forms/form'; import Form from './ascribe_forms/form';
import Property from './ascribe_forms/property'; import Property from './ascribe_forms/property';
import FormPropertyHeader from './ascribe_forms/form_property_header';
import apiUrls from '../constants/api_urls'; import apiUrls from '../constants/api_urls';
import AppConstants from '../constants/application_constants'; import AppConstants from '../constants/application_constants';
@ -61,10 +62,8 @@ let LoginContainer = React.createClass({
return ( return (
<div className="ascribe-login-wrapper"> <div className="ascribe-login-wrapper">
<br/> <br/>
<div className="ascribe-login-text ascribe-login-header"> <LoginForm
{this.props.message} message={this.props.message} />
</div>
<LoginForm />
<div className="ascribe-login-text"> <div className="ascribe-login-text">
{getLangText('Not an ascribe user')}&#63; <Link to="signup">{getLangText('Sign up')}...</Link><br/> {getLangText('Not an ascribe user')}&#63; <Link to="signup">{getLangText('Sign up')}...</Link><br/>
{getLangText('Forgot my password')}&#63; <Link to="password_reset">{getLangText('Rescue me')}...</Link> {getLangText('Forgot my password')}&#63; <Link to="password_reset">{getLangText('Rescue me')}...</Link>
@ -77,7 +76,8 @@ let LoginContainer = React.createClass({
let LoginForm = React.createClass({ let LoginForm = React.createClass({
propTypes: { propTypes: {
redirectOnLoginSuccess: React.PropTypes.bool redirectOnLoginSuccess: React.PropTypes.bool,
message: React.PropTypes.string
}, },
handleSuccess(){ handleSuccess(){
@ -106,6 +106,7 @@ let LoginForm = React.createClass({
render() { render() {
return ( return (
<Form <Form
className="ascribe-form-bordered"
ref="loginForm" ref="loginForm"
url={apiUrls.users_login} url={apiUrls.users_login}
handleSuccess={this.handleSuccess} handleSuccess={this.handleSuccess}
@ -120,6 +121,9 @@ let LoginForm = React.createClass({
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" /> <img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
</button> </button>
}> }>
<FormPropertyHeader>
<h3>{this.props.message}</h3>
</FormPropertyHeader>
<Property <Property
name='email' name='email'
label={getLangText('Email')}> label={getLangText('Email')}>
@ -140,7 +144,6 @@ let LoginForm = React.createClass({
name="password" name="password"
required/> required/>
</Property> </Property>
<hr />
</Form> </Form>
); );
} }