From 041daf86b48ce4bc6a3066165a66a1556451a8b1 Mon Sep 17 00:00:00 2001 From: romanetar Date: Tue, 29 Mar 2022 17:18:08 -0300 Subject: [PATCH] Sign in flow UI refactor Signed-off-by: romanetar --- resources/js/login/login.js | 201 ++++++++++-------- resources/js/login/login.module.scss | 45 ++-- .../views/auth/register_success.blade.php | 9 +- 3 files changed, 149 insertions(+), 106 deletions(-) diff --git a/resources/js/login/login.js b/resources/js/login/login.js index 04816ad4..e15935c4 100644 --- a/resources/js/login/login.js +++ b/resources/js/login/login.js @@ -67,18 +67,19 @@ const PasswordInputForm = ({ onAuthenticate, disableInput, showPassword, - passwordValue, - passwordError, - onUserPasswordChange, - handleClickShowPassword, - handleMouseDownPassword, - userNameValue, - csrfToken, - shouldShowCaptcha, - captchaPublicKey, - onChangeRecaptcha, - handleEmitOtpAction -}) => { + passwordValue, + passwordError, + onUserPasswordChange, + handleClickShowPassword, + handleMouseDownPassword, + userNameValue, + csrfToken, + shouldShowCaptcha, + captchaPublicKey, + onChangeRecaptcha, + handleEmitOtpAction, + forgotPasswordAction + }) => { return (
- {showPassword ? : } + {showPassword ? : } ) }} /> {passwordError && -

+

} - } - label="Remember me" - /> - - - + + + + + + } + label="Remember me" + /> + + + + + + {shouldShowCaptcha() && ); @@ -217,24 +232,24 @@ const OTPInputForm = ({ } const HelpLinks = ({ - userName, - showEmitOtpAction, - forgotPasswordAction, - showForgotPasswordAction, - showVerifyEmailAction, - verifyEmailAction, - showHelpAction, - helpAction, - appName, - emitOtpAction -}) => { + userName, + showEmitOtpAction, + forgotPasswordAction, + showForgotPasswordAction, + showVerifyEmailAction, + verifyEmailAction, + showHelpAction, + helpAction, + appName, + emitOtpAction + }) => { if (userName) { forgotPasswordAction = `${forgotPasswordAction}?email=${encodeURIComponent(userName)}`; } return ( <> -
+
{ showEmitOtpAction && @@ -275,44 +290,61 @@ const OTPHelpLinks = ({ emitOtpAction }) => { const EmailErrorActions = ({ emitOtpAction, createAccountAction, onValidateEmail, disableInput }) => { return ( - - -

- Access your account by having - a single-use login code emailed to you. Or - establish your account by setting up a password. -

-
- - + + + + + + + + + + + ); } -const ExistingAccountActions = ({ emitOtpAction, onAuthenticate, disableInput }) => { +const ExistingAccountActions = ({emitOtpAction, forgotPasswordAction, userName}) => { + if (userName) { + forgotPasswordAction = `${forgotPasswordAction}?email=${encodeURIComponent(userName)}`; + } + return ( - - -

- You have an existing account. If you don't remember or never set a password, - get a single-use login code emailed to you now. -

-
- + + + + + Reset your password + + ); } @@ -483,7 +515,7 @@ class LoginPage extends React.Component { let newErrors = {}; newErrors['password'] = ''; - newErrors['email'] = "We could not find an Account with that email Address"; + newErrors['email'] = " "; if (status == 429) { newErrors['email'] = "Too many requests. Try it later."; @@ -539,30 +571,28 @@ class LoginPage extends React.Component {
- {this.props.appName} + {this.props.appName} - Sign in {this.state.user_fullname && } - variant="outlined" - className={styles.valid_user_name_chip} - label={this.state.user_fullname} - onDelete={this.handleDelete} />} + {this.state.errors.email ? 'Create an account for:' : 'Login'} + {this.state.user_fullname && + } + variant="outlined" + className={styles.valid_user_name_chip} + label={this.state.user_fullname} + onDelete={this.handleDelete}/> + } {!this.state.user_verified && <> {this.state.allowNativeAuth && - <> - - {this.state.errors.email == '' && -

If you have just registered for an event or don't know your password, enter your email - address and you'll be able to request a single-use login code.

- } - + } {this.state.errors.email == '' && this.props.thirdPartyProviders.length > 0 && @@ -618,6 +648,7 @@ class LoginPage extends React.Component { captchaPublicKey={this.props.captchaPublicKey} onChangeRecaptcha={this.onChangeRecaptcha} handleEmitOtpAction={this.handleEmitOtpAction} + forgotPasswordAction={this.props.forgotPasswordAction} /> diff --git a/resources/js/login/login.module.scss b/resources/js/login/login.module.scss index f02d8203..6431b7f4 100644 --- a/resources/js/login/login.module.scss +++ b/resources/js/login/login.module.scss @@ -53,24 +53,33 @@ p > a { h1.app_logo_container { text-align: center; } - .app_logo{ - max-width: 40%; - margin-bottom: 15%; - } - .continue_btn{ - float: right; - margin-top: 30%; - } - .recaptcha{ - width: 100%; - margin-top: 10px; - margin-bottom: 10px; - } - .separator{ - color:$base-color; - width: 100%; - border: 1px solid; - margin-bottom: 5%; + + .app_logo { + max-width: 40%; + margin-bottom: 15%; + } + + .continue_btn { + float: right; + margin-top: 30%; + } + + .secondary_btn { + min-width: 300px; + text-transform: none; + } + + .recaptcha { + width: 100%; + margin-top: 10px; + margin-bottom: 10px; + } + + .separator { + color: $base-color; + width: 100%; + border: 1px solid; + margin-bottom: 5%; margin-top: 5%; } } diff --git a/resources/views/auth/register_success.blade.php b/resources/views/auth/register_success.blade.php index ca3329f9..7fb46962 100644 --- a/resources/views/auth/register_success.blade.php +++ b/resources/views/auth/register_success.blade.php @@ -11,10 +11,13 @@ @section('content')
-

Thank you for creating an {!! Config::get("app.app_name") !!}. You will be receiving an email to verify your email address and - then another confirming you have successfully created your {!! Config::get("app.app_name") !!} after your email is verified.

+

Almost done!

+

Final step: You will receive an email shortly asking you to verify your email address + by clicking a link.

+

Thank you for creating an {!! Config::get("app.app_name") !!}.

@if($redirect_uri) -

Now you will be redirected to {{$redirect_uri}}

+

Now you will be redirected to {{$redirect_uri}}

@endif