aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth/Signup.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/auth/Signup.js')
-rw-r--r--src/components/auth/Signup.js37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/components/auth/Signup.js b/src/components/auth/Signup.js
index 00625a3ac..00b387b25 100644
--- a/src/components/auth/Signup.js
+++ b/src/components/auth/Signup.js
@@ -4,14 +4,11 @@ import PropTypes from 'prop-types';
4import { observer, inject } from 'mobx-react'; 4import { observer, inject } from 'mobx-react';
5import { defineMessages, injectIntl } from 'react-intl'; 5import { defineMessages, injectIntl } from 'react-intl';
6 6
7import { isDevMode, useLiveAPI } from '../../environment-remote';
8import Form from '../../lib/Form'; 7import Form from '../../lib/Form';
9import { required, email, minLength } from '../../helpers/validation-helpers'; 8import { required, email, minLength } from '../../helpers/validation-helpers';
10import serverlessLogin from '../../helpers/serverless-helpers';
11import Input from '../ui/Input'; 9import Input from '../ui/Input';
12import Button from '../ui/Button'; 10import Button from '../ui/Button';
13import Link from '../ui/Link'; 11import Link from '../ui/Link';
14import Infobox from '../ui/Infobox';
15 12
16import { globalError as globalErrorPropType } from '../../prop-types'; 13import { globalError as globalErrorPropType } from '../../prop-types';
17import { termsBase } from '../../api/apiBase'; 14import { termsBase } from '../../api/apiBase';
@@ -61,30 +58,18 @@ const messages = defineMessages({
61 id: 'signup.link.login', 58 id: 'signup.link.login',
62 defaultMessage: 'Already have an account, sign in?', 59 defaultMessage: 'Already have an account, sign in?',
63 }, 60 },
64 changeServer: {
65 id: 'login.changeServer',
66 defaultMessage: 'Change server',
67 },
68 serverless: {
69 id: 'services.serverless',
70 defaultMessage: 'Use Ferdi without an Account',
71 },
72 emailDuplicate: { 61 emailDuplicate: {
73 id: 'signup.emailDuplicate', 62 id: 'signup.emailDuplicate',
74 defaultMessage: 'A user with that email address already exists', 63 defaultMessage: 'A user with that email address already exists',
75 }, 64 },
76}); 65});
77 66
78@inject('actions')
79@observer
80class Signup extends Component { 67class Signup extends Component {
81 static propTypes = { 68 static propTypes = {
82 onSubmit: PropTypes.func.isRequired, 69 onSubmit: PropTypes.func.isRequired,
83 isSubmitting: PropTypes.bool.isRequired, 70 isSubmitting: PropTypes.bool.isRequired,
84 loginRoute: PropTypes.string.isRequired, 71 loginRoute: PropTypes.string.isRequired,
85 changeServerRoute: PropTypes.string.isRequired,
86 error: globalErrorPropType.isRequired, 72 error: globalErrorPropType.isRequired,
87 actions: PropTypes.object.isRequired,
88 }; 73 };
89 74
90 form = new Form( 75 form = new Form(
@@ -126,14 +111,10 @@ class Signup extends Component {
126 }); 111 });
127 } 112 }
128 113
129 useLocalServer() {
130 serverlessLogin(this.props.actions);
131 }
132
133 render() { 114 render() {
134 const { form } = this; 115 const { form } = this;
135 const { intl } = this.props; 116 const { intl } = this.props;
136 const { isSubmitting, loginRoute, error, changeServerRoute } = this.props; 117 const { isSubmitting, loginRoute, error } = this.props;
137 118
138 return ( 119 return (
139 <div className="auth__scroll-container"> 120 <div className="auth__scroll-container">
@@ -142,14 +123,8 @@ class Signup extends Component {
142 className="franz-form auth__form" 123 className="franz-form auth__form"
143 onSubmit={e => this.submit(e)} 124 onSubmit={e => this.submit(e)}
144 > 125 >
145 <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> 126 <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link>
146 <h1>{intl.formatMessage(messages.headline)}</h1> 127 <h1>{intl.formatMessage(messages.headline)}</h1>
147 {isDevMode && !useLiveAPI && (
148 <Infobox type="warning">
149 In Dev Mode your data is not persistent. Please use the live app
150 for accesing the production API.
151 </Infobox>
152 )}
153 <div className="grid__row"> 128 <div className="grid__row">
154 <Input field={form.$('firstname')} focus /> 129 <Input field={form.$('firstname')} focus />
155 <Input field={form.$('lastname')} /> 130 <Input field={form.$('lastname')} />
@@ -201,12 +176,6 @@ class Signup extends Component {
201 </p> 176 </p>
202 </form> 177 </form>
203 <div className="auth__links"> 178 <div className="auth__links">
204 <Link to={changeServerRoute}>
205 {intl.formatMessage(messages.changeServer)}
206 </Link>
207 <a onClick={this.useLocalServer.bind(this)}>
208 {intl.formatMessage(messages.serverless)}
209 </a>
210 <Link to={loginRoute}> 179 <Link to={loginRoute}>
211 {intl.formatMessage(messages.loginLink)} 180 {intl.formatMessage(messages.loginLink)}
212 </Link> 181 </Link>
@@ -217,4 +186,4 @@ class Signup extends Component {
217 } 186 }
218} 187}
219 188
220export default injectIntl(Signup); 189export default injectIntl(inject('actions')(observer(Signup)));