diff options
Diffstat (limited to 'src/components/auth/Signup.js')
-rw-r--r-- | src/components/auth/Signup.js | 37 |
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'; | |||
4 | import { observer, inject } from 'mobx-react'; | 4 | import { observer, inject } from 'mobx-react'; |
5 | import { defineMessages, injectIntl } from 'react-intl'; | 5 | import { defineMessages, injectIntl } from 'react-intl'; |
6 | 6 | ||
7 | import { isDevMode, useLiveAPI } from '../../environment-remote'; | ||
8 | import Form from '../../lib/Form'; | 7 | import Form from '../../lib/Form'; |
9 | import { required, email, minLength } from '../../helpers/validation-helpers'; | 8 | import { required, email, minLength } from '../../helpers/validation-helpers'; |
10 | import serverlessLogin from '../../helpers/serverless-helpers'; | ||
11 | import Input from '../ui/Input'; | 9 | import Input from '../ui/Input'; |
12 | import Button from '../ui/Button'; | 10 | import Button from '../ui/Button'; |
13 | import Link from '../ui/Link'; | 11 | import Link from '../ui/Link'; |
14 | import Infobox from '../ui/Infobox'; | ||
15 | 12 | ||
16 | import { globalError as globalErrorPropType } from '../../prop-types'; | 13 | import { globalError as globalErrorPropType } from '../../prop-types'; |
17 | import { termsBase } from '../../api/apiBase'; | 14 | import { 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 | ||
80 | class Signup extends Component { | 67 | class 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 | ||
220 | export default injectIntl(Signup); | 189 | export default injectIntl(inject('actions')(observer(Signup))); |