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

68 lines
1.7 KiB
JavaScript
Raw Normal View History

2015-06-20 16:43:18 +02:00
'use strict';
import React from 'react';
import { Link } from 'react-router';
2015-07-13 16:57:25 +02:00
import SignupForm from './ascribe_forms/form_signup';
2015-06-20 16:43:18 +02:00
import { getLangText } from '../utils/lang_utils';
import { setDocumentTitle } from '../utils/dom_utils';
2015-06-20 16:43:18 +02:00
2015-06-22 10:50:22 +02:00
let SignupContainer = React.createClass({
propTypes: {
// Provided from AscribeApp
currentUser: React.PropTypes.object,
whitelabel: React.PropTypes.object,
2016-01-11 16:26:36 +01:00
// Provided from router
location: React.PropTypes.object
},
getInitialState() {
2015-07-13 16:57:25 +02:00
return {
2015-06-22 10:50:22 +02:00
submitted: false,
message: null
2015-07-13 16:57:25 +02:00
};
},
handleSuccess(message) {
2015-06-22 10:50:22 +02:00
this.setState({
submitted: true,
message: message
});
},
2015-06-20 16:43:18 +02:00
render() {
const { location } = this.props;
const { message, submitted } = this.state;
setDocumentTitle(getLangText('Sign up'));
if (submitted) {
2015-06-22 10:50:22 +02:00
return (
<div className="ascribe-login-wrapper">
<br/>
<div className="ascribe-login-text ascribe-login-header">
{message}
2015-06-22 10:50:22 +02:00
</div>
</div>
);
}
2015-06-20 16:43:18 +02:00
return (
<div className="ascribe-login-wrapper">
<SignupForm
handleSuccess={this.handleSuccess}
location={location}/>
<div className="ascribe-login-text">
{getLangText('Already an ascribe user')}&#63; <Link to="/login">{getLangText('Log in')}...</Link><br/>
</div>
2015-06-20 16:43:18 +02:00
</div>
2015-06-20 16:43:18 +02:00
);
}
});
2015-07-13 16:57:25 +02:00
export default SignupContainer;