mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
import React from 'react';
|
|
import Link from 'react-router/es6/Link';
|
|
|
|
import SignupForm from './ascribe_forms/form_signup';
|
|
|
|
import withContext from './context/with_context';
|
|
import { whitelabelShape } from './prop_types';
|
|
|
|
import { setDocumentTitle } from '../utils/dom_utils';
|
|
import { getLangText } from '../utils/lang_utils';
|
|
|
|
|
|
let SignupContainer = React.createClass({
|
|
propTypes: {
|
|
// Injected through HOCs
|
|
whitelabel: whitelabelShape.isRequired
|
|
},
|
|
|
|
getInitialState() {
|
|
return {
|
|
submitted: false,
|
|
message: null
|
|
};
|
|
},
|
|
|
|
handleSuccess(message) {
|
|
this.setState({
|
|
submitted: true,
|
|
message: message
|
|
});
|
|
},
|
|
|
|
render() {
|
|
const { whitelabel: { name: whitelabelName } } = this.props;
|
|
const { message, submitted } = this.state;
|
|
|
|
setDocumentTitle(getLangText('Sign up'));
|
|
|
|
if (submitted) {
|
|
return (
|
|
<div className="ascribe-login-wrapper">
|
|
<br/>
|
|
<div className="ascribe-login-text ascribe-login-header">
|
|
{message}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
return (
|
|
<div className="ascribe-login-wrapper">
|
|
<SignupForm
|
|
handleSuccess={this.handleSuccess}
|
|
whitelabelName={whitelabelName} />
|
|
<div className="ascribe-login-text">
|
|
{getLangText(`Already a ${whitelabelName || 'ascribe'} user`)}? <Link to="/login">{getLangText('Log in')}...</Link><br/>
|
|
</div>
|
|
</div>
|
|
|
|
);
|
|
}
|
|
});
|
|
|
|
export default withContext(SignupContainer, 'whitelabel');
|