aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar kytwb <kytwb@pm.me>2021-12-13 06:42:12 +0100
committerLibravatar kytwb <kytwb@pm.me>2021-12-13 06:42:12 +0100
commit1553ea204a88cd8ee4aeb9bf4b08388677d412b0 (patch)
tree764e4b5ca3c3a0eb33689ffd47285a9547f21334
parentFix sidebar scrolling in horizontal mode (diff)
downloadferdium-app-1553ea204a88cd8ee4aeb9bf4b08388677d412b0.tar.gz
ferdium-app-1553ea204a88cd8ee4aeb9bf4b08388677d412b0.tar.zst
ferdium-app-1553ea204a88cd8ee4aeb9bf4b08388677d412b0.zip
Simplify navigation in auth screens
-rw-r--r--src/components/auth/ChangeServer.js3
-rw-r--r--src/components/auth/Login.js24
-rw-r--r--src/components/auth/Password.js2
-rw-r--r--src/components/auth/Signup.js25
-rw-r--r--src/components/auth/Welcome.js6
-rw-r--r--src/containers/auth/LoginScreen.js1
-rw-r--r--src/containers/auth/SignupScreen.js1
7 files changed, 11 insertions, 51 deletions
diff --git a/src/components/auth/ChangeServer.js b/src/components/auth/ChangeServer.js
index a659cdc31..4c69b2821 100644
--- a/src/components/auth/ChangeServer.js
+++ b/src/components/auth/ChangeServer.js
@@ -6,6 +6,7 @@ import Form from '../../lib/Form';
6import Input from '../ui/Input'; 6import Input from '../ui/Input';
7import Select from '../ui/Select'; 7import Select from '../ui/Select';
8import Button from '../ui/Button'; 8import Button from '../ui/Button';
9import Link from '../ui/Link';
9import Infobox from '../ui/Infobox'; 10import Infobox from '../ui/Infobox';
10import { url, required } from '../../helpers/validation-helpers'; 11import { url, required } from '../../helpers/validation-helpers';
11import { LIVE_FERDI_API, LIVE_FRANZ_API } from '../../config'; 12import { LIVE_FERDI_API, LIVE_FRANZ_API } from '../../config';
@@ -105,7 +106,7 @@ class ChangeServer extends Component {
105 return ( 106 return (
106 <div className="auth__container"> 107 <div className="auth__container">
107 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> 108 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}>
108 <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> 109 <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link>
109 <h1>{intl.formatMessage(messages.headline)}</h1> 110 <h1>{intl.formatMessage(messages.headline)}</h1>
110 {form.$('server').value === this.franzServer && ( 111 {form.$('server').value === this.franzServer && (
111 <Infobox type="warning"> 112 <Infobox type="warning">
diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js
index 684b2f6f3..bd01f25cd 100644
--- a/src/components/auth/Login.js
+++ b/src/components/auth/Login.js
@@ -8,7 +8,6 @@ import { LIVE_FRANZ_API } from '../../config';
8import { API_VERSION } from '../../environment-remote'; 8import { API_VERSION } from '../../environment-remote';
9import Form from '../../lib/Form'; 9import Form from '../../lib/Form';
10import { required, email } from '../../helpers/validation-helpers'; 10import { required, email } from '../../helpers/validation-helpers';
11import serverlessLogin from '../../helpers/serverless-helpers';
12import Input from '../ui/Input'; 11import Input from '../ui/Input';
13import Button from '../ui/Button'; 12import Button from '../ui/Button';
14import Link from '../ui/Link'; 13import Link from '../ui/Link';
@@ -56,14 +55,6 @@ const messages = defineMessages({
56 id: 'login.link.signup', 55 id: 'login.link.signup',
57 defaultMessage: 'Create a free account', 56 defaultMessage: 'Create a free account',
58 }, 57 },
59 changeServer: {
60 id: 'login.changeServer',
61 defaultMessage: 'Change server',
62 },
63 serverless: {
64 id: 'services.serverless',
65 defaultMessage: 'Use Ferdi without an Account',
66 },
67 passwordLink: { 58 passwordLink: {
68 id: 'login.link.password', 59 id: 'login.link.password',
69 defaultMessage: 'Reset password', 60 defaultMessage: 'Reset password',
@@ -78,9 +69,7 @@ class Login extends Component {
78 isServerLogout: PropTypes.bool.isRequired, 69 isServerLogout: PropTypes.bool.isRequired,
79 signupRoute: PropTypes.string.isRequired, 70 signupRoute: PropTypes.string.isRequired,
80 passwordRoute: PropTypes.string.isRequired, 71 passwordRoute: PropTypes.string.isRequired,
81 changeServerRoute: PropTypes.string.isRequired,
82 error: globalErrorPropType.isRequired, 72 error: globalErrorPropType.isRequired,
83 actions: PropTypes.object.isRequired,
84 }; 73 };
85 74
86 form = new Form( 75 form = new Form(
@@ -112,10 +101,6 @@ class Login extends Component {
112 }); 101 });
113 } 102 }
114 103
115 useLocalServer() {
116 serverlessLogin(this.props.actions);
117 }
118
119 render() { 104 render() {
120 const { form } = this; 105 const { form } = this;
121 const { intl } = this.props; 106 const { intl } = this.props;
@@ -125,14 +110,13 @@ class Login extends Component {
125 isServerLogout, 110 isServerLogout,
126 signupRoute, 111 signupRoute,
127 passwordRoute, 112 passwordRoute,
128 changeServerRoute,
129 error, 113 error,
130 } = this.props; 114 } = this.props;
131 115
132 return ( 116 return (
133 <div className="auth__container"> 117 <div className="auth__container">
134 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> 118 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}>
135 <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> 119 <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link>
136 <h1>{intl.formatMessage(messages.headline)}</h1> 120 <h1>{intl.formatMessage(messages.headline)}</h1>
137 {isTokenExpired && ( 121 {isTokenExpired && (
138 <p className="error-message center"> 122 <p className="error-message center">
@@ -188,12 +172,6 @@ class Login extends Component {
188 )} 172 )}
189 </form> 173 </form>
190 <div className="auth__links"> 174 <div className="auth__links">
191 <Link to={changeServerRoute}>
192 {intl.formatMessage(messages.changeServer)}
193 </Link>
194 <a onClick={this.useLocalServer.bind(this)}>
195 {intl.formatMessage(messages.serverless)}
196 </a>
197 <Link to={signupRoute}> 175 <Link to={signupRoute}>
198 {intl.formatMessage(messages.signupLink)} 176 {intl.formatMessage(messages.signupLink)}
199 </Link> 177 </Link>
diff --git a/src/components/auth/Password.js b/src/components/auth/Password.js
index b4d51f43d..49930f6bd 100644
--- a/src/components/auth/Password.js
+++ b/src/components/auth/Password.js
@@ -78,7 +78,7 @@ class Password extends Component {
78 return ( 78 return (
79 <div className="auth__container"> 79 <div className="auth__container">
80 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> 80 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}>
81 <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> 81 <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link>
82 <h1>{intl.formatMessage(messages.headline)}</h1> 82 <h1>{intl.formatMessage(messages.headline)}</h1>
83 {status.length > 0 && status.includes('sent') && ( 83 {status.length > 0 && status.includes('sent') && (
84 <Infobox type="success" icon="checkbox-marked-circle-outline"> 84 <Infobox type="success" icon="checkbox-marked-circle-outline">
diff --git a/src/components/auth/Signup.js b/src/components/auth/Signup.js
index 6526264e0..00b387b25 100644
--- a/src/components/auth/Signup.js
+++ b/src/components/auth/Signup.js
@@ -6,7 +6,6 @@ import { defineMessages, injectIntl } from 'react-intl';
6 6
7import Form from '../../lib/Form'; 7import Form from '../../lib/Form';
8import { required, email, minLength } from '../../helpers/validation-helpers'; 8import { required, email, minLength } from '../../helpers/validation-helpers';
9import serverlessLogin from '../../helpers/serverless-helpers';
10import Input from '../ui/Input'; 9import Input from '../ui/Input';
11import Button from '../ui/Button'; 10import Button from '../ui/Button';
12import Link from '../ui/Link'; 11import Link from '../ui/Link';
@@ -59,14 +58,6 @@ const messages = defineMessages({
59 id: 'signup.link.login', 58 id: 'signup.link.login',
60 defaultMessage: 'Already have an account, sign in?', 59 defaultMessage: 'Already have an account, sign in?',
61 }, 60 },
62 changeServer: {
63 id: 'login.changeServer',
64 defaultMessage: 'Change server',
65 },
66 serverless: {
67 id: 'services.serverless',
68 defaultMessage: 'Use Ferdi without an Account',
69 },
70 emailDuplicate: { 61 emailDuplicate: {
71 id: 'signup.emailDuplicate', 62 id: 'signup.emailDuplicate',
72 defaultMessage: 'A user with that email address already exists', 63 defaultMessage: 'A user with that email address already exists',
@@ -78,9 +69,7 @@ class Signup extends Component {
78 onSubmit: PropTypes.func.isRequired, 69 onSubmit: PropTypes.func.isRequired,
79 isSubmitting: PropTypes.bool.isRequired, 70 isSubmitting: PropTypes.bool.isRequired,
80 loginRoute: PropTypes.string.isRequired, 71 loginRoute: PropTypes.string.isRequired,
81 changeServerRoute: PropTypes.string.isRequired,
82 error: globalErrorPropType.isRequired, 72 error: globalErrorPropType.isRequired,
83 actions: PropTypes.object.isRequired,
84 }; 73 };
85 74
86 form = new Form( 75 form = new Form(
@@ -122,14 +111,10 @@ class Signup extends Component {
122 }); 111 });
123 } 112 }
124 113
125 useLocalServer() {
126 serverlessLogin(this.props.actions);
127 }
128
129 render() { 114 render() {
130 const { form } = this; 115 const { form } = this;
131 const { intl } = this.props; 116 const { intl } = this.props;
132 const { isSubmitting, loginRoute, error, changeServerRoute } = this.props; 117 const { isSubmitting, loginRoute, error } = this.props;
133 118
134 return ( 119 return (
135 <div className="auth__scroll-container"> 120 <div className="auth__scroll-container">
@@ -138,7 +123,7 @@ class Signup extends Component {
138 className="franz-form auth__form" 123 className="franz-form auth__form"
139 onSubmit={e => this.submit(e)} 124 onSubmit={e => this.submit(e)}
140 > 125 >
141 <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>
142 <h1>{intl.formatMessage(messages.headline)}</h1> 127 <h1>{intl.formatMessage(messages.headline)}</h1>
143 <div className="grid__row"> 128 <div className="grid__row">
144 <Input field={form.$('firstname')} focus /> 129 <Input field={form.$('firstname')} focus />
@@ -191,12 +176,6 @@ class Signup extends Component {
191 </p> 176 </p>
192 </form> 177 </form>
193 <div className="auth__links"> 178 <div className="auth__links">
194 <Link to={changeServerRoute}>
195 {intl.formatMessage(messages.changeServer)}
196 </Link>
197 <a onClick={this.useLocalServer.bind(this)}>
198 {intl.formatMessage(messages.serverless)}
199 </a>
200 <Link to={loginRoute}> 179 <Link to={loginRoute}>
201 {intl.formatMessage(messages.loginLink)} 180 {intl.formatMessage(messages.loginLink)}
202 </Link> 181 </Link>
diff --git a/src/components/auth/Welcome.js b/src/components/auth/Welcome.js
index bcdec243d..380565ff6 100644
--- a/src/components/auth/Welcome.js
+++ b/src/components/auth/Welcome.js
@@ -17,6 +17,10 @@ const messages = defineMessages({
17 id: 'welcome.loginButton', 17 id: 'welcome.loginButton',
18 defaultMessage: 'Login to your account', 18 defaultMessage: 'Login to your account',
19 }, 19 },
20 changeServer: {
21 id: 'login.changeServer',
22 defaultMessage: 'Change server'
23 },
20 serverless: { 24 serverless: {
21 id: 'services.serverless', 25 id: 'services.serverless',
22 defaultMessage: 'Use Ferdi without an Account', 26 defaultMessage: 'Use Ferdi without an Account',
@@ -70,7 +74,7 @@ class Login extends Component {
70 cursor: 'pointer', 74 cursor: 'pointer',
71 }} 75 }}
72 > 76 >
73 Change server 77 {intl.formatMessage(messages.changeServer)}
74 </span> 78 </span>
75 </Link> 79 </Link>
76 <br /> 80 <br />
diff --git a/src/containers/auth/LoginScreen.js b/src/containers/auth/LoginScreen.js
index 572a38ea1..f8351f458 100644
--- a/src/containers/auth/LoginScreen.js
+++ b/src/containers/auth/LoginScreen.js
@@ -23,7 +23,6 @@ class LoginScreen extends Component {
23 } 23 }
24 signupRoute={stores.user.signupRoute} 24 signupRoute={stores.user.signupRoute}
25 passwordRoute={stores.user.passwordRoute} 25 passwordRoute={stores.user.passwordRoute}
26 changeServerRoute={stores.user.changeServerRoute}
27 error={error} 26 error={error}
28 /> 27 />
29 ); 28 );
diff --git a/src/containers/auth/SignupScreen.js b/src/containers/auth/SignupScreen.js
index 1dd8d0772..3824e47d5 100644
--- a/src/containers/auth/SignupScreen.js
+++ b/src/containers/auth/SignupScreen.js
@@ -27,7 +27,6 @@ class SignupScreen extends Component {
27 onSubmit={values => this.onSignup(values)} 27 onSubmit={values => this.onSignup(values)}
28 isSubmitting={stores.user.signupRequest.isExecuting} 28 isSubmitting={stores.user.signupRequest.isExecuting}
29 loginRoute={stores.user.loginRoute} 29 loginRoute={stores.user.loginRoute}
30 changeServerRoute={stores.user.changeServerRoute}
31 error={error} 30 error={error}
32 /> 31 />
33 ); 32 );