|
|
|
|
@ -68,6 +68,7 @@ const Login = React.memo(
|
|
|
|
|
isSubmittingUsingOidc,
|
|
|
|
|
error,
|
|
|
|
|
withOidc,
|
|
|
|
|
isOidcEnforced,
|
|
|
|
|
onAuthenticate,
|
|
|
|
|
onAuthenticateUsingOidc,
|
|
|
|
|
onMessageDismiss,
|
|
|
|
|
@ -107,8 +108,10 @@ const Login = React.memo(
|
|
|
|
|
}, [onAuthenticate, data]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
emailOrUsernameField.current.focus();
|
|
|
|
|
}, []);
|
|
|
|
|
if (!isOidcEnforced) {
|
|
|
|
|
emailOrUsernameField.current.focus();
|
|
|
|
|
}
|
|
|
|
|
}, [isOidcEnforced]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (wasSubmitting && !isSubmitting && error) {
|
|
|
|
|
@ -159,51 +162,57 @@ const Login = React.memo(
|
|
|
|
|
onDismiss={onMessageDismiss}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<Form size="large" onSubmit={handleSubmit}>
|
|
|
|
|
<div className={styles.inputWrapper}>
|
|
|
|
|
<div className={styles.inputLabel}>{t('common.emailOrUsername')}</div>
|
|
|
|
|
<Input
|
|
|
|
|
fluid
|
|
|
|
|
ref={emailOrUsernameField}
|
|
|
|
|
name="emailOrUsername"
|
|
|
|
|
value={data.emailOrUsername}
|
|
|
|
|
readOnly={isSubmitting}
|
|
|
|
|
className={styles.input}
|
|
|
|
|
onChange={handleFieldChange}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className={styles.inputWrapper}>
|
|
|
|
|
<div className={styles.inputLabel}>{t('common.password')}</div>
|
|
|
|
|
<Input.Password
|
|
|
|
|
fluid
|
|
|
|
|
ref={passwordField}
|
|
|
|
|
name="password"
|
|
|
|
|
value={data.password}
|
|
|
|
|
readOnly={isSubmitting}
|
|
|
|
|
className={styles.input}
|
|
|
|
|
onChange={handleFieldChange}
|
|
|
|
|
{!isOidcEnforced && (
|
|
|
|
|
<Form size="large" onSubmit={handleSubmit}>
|
|
|
|
|
<div className={styles.inputWrapper}>
|
|
|
|
|
<div className={styles.inputLabel}>{t('common.emailOrUsername')}</div>
|
|
|
|
|
<Input
|
|
|
|
|
fluid
|
|
|
|
|
ref={emailOrUsernameField}
|
|
|
|
|
name="emailOrUsername"
|
|
|
|
|
value={data.emailOrUsername}
|
|
|
|
|
readOnly={isSubmitting}
|
|
|
|
|
className={styles.input}
|
|
|
|
|
onChange={handleFieldChange}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className={styles.inputWrapper}>
|
|
|
|
|
<div className={styles.inputLabel}>{t('common.password')}</div>
|
|
|
|
|
<Input.Password
|
|
|
|
|
fluid
|
|
|
|
|
ref={passwordField}
|
|
|
|
|
name="password"
|
|
|
|
|
value={data.password}
|
|
|
|
|
readOnly={isSubmitting}
|
|
|
|
|
className={styles.input}
|
|
|
|
|
onChange={handleFieldChange}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Form.Button
|
|
|
|
|
primary
|
|
|
|
|
size="large"
|
|
|
|
|
icon="right arrow"
|
|
|
|
|
labelPosition="right"
|
|
|
|
|
content={t('action.logIn')}
|
|
|
|
|
floated="right"
|
|
|
|
|
loading={isSubmitting}
|
|
|
|
|
disabled={isSubmitting || isSubmittingUsingOidc}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Form.Button
|
|
|
|
|
primary
|
|
|
|
|
size="large"
|
|
|
|
|
icon="right arrow"
|
|
|
|
|
labelPosition="right"
|
|
|
|
|
content={t('action.logIn')}
|
|
|
|
|
floated="right"
|
|
|
|
|
loading={isSubmitting}
|
|
|
|
|
disabled={isSubmitting || isSubmittingUsingOidc}
|
|
|
|
|
/>
|
|
|
|
|
</Form>
|
|
|
|
|
</Form>
|
|
|
|
|
)}
|
|
|
|
|
{withOidc && (
|
|
|
|
|
<Button
|
|
|
|
|
type="button"
|
|
|
|
|
fluid={isOidcEnforced}
|
|
|
|
|
primary={isOidcEnforced}
|
|
|
|
|
size={isOidcEnforced ? 'large' : undefined}
|
|
|
|
|
icon={isOidcEnforced ? 'right arrow' : undefined}
|
|
|
|
|
labelPosition={isOidcEnforced ? 'right' : undefined}
|
|
|
|
|
content={t('action.logInWithSSO')}
|
|
|
|
|
loading={isSubmittingUsingOidc}
|
|
|
|
|
disabled={isSubmitting || isSubmittingUsingOidc}
|
|
|
|
|
onClick={onAuthenticateUsingOidc}
|
|
|
|
|
>
|
|
|
|
|
{t('action.logInWithSSO')}
|
|
|
|
|
</Button>
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -242,6 +251,7 @@ Login.propTypes = {
|
|
|
|
|
isSubmittingUsingOidc: PropTypes.bool.isRequired,
|
|
|
|
|
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
|
|
|
|
withOidc: PropTypes.bool.isRequired,
|
|
|
|
|
isOidcEnforced: PropTypes.bool.isRequired,
|
|
|
|
|
onAuthenticate: PropTypes.func.isRequired,
|
|
|
|
|
onAuthenticateUsingOidc: PropTypes.func.isRequired,
|
|
|
|
|
onMessageDismiss: PropTypes.func.isRequired,
|
|
|
|
|
|