diff --git a/client/src/components/Login/Login.jsx b/client/src/components/Login/Login.jsx
index 6bedd712..d408c9fc 100755
--- a/client/src/components/Login/Login.jsx
+++ b/client/src/components/Login/Login.jsx
@@ -124,6 +124,7 @@ const Login = React.memo(
case 'Invalid credentials':
case 'Invalid email or username':
emailOrUsernameField.current.select();
+
break;
case 'Invalid password':
setData((prevData) => ({
@@ -131,6 +132,7 @@ const Login = React.memo(
password: '',
}));
focusPasswordField();
+
break;
default:
}
@@ -141,13 +143,6 @@ const Login = React.memo(
passwordField.current.focus();
}, [focusPasswordFieldState]);
- useEffect(() => {
- const params = new URLSearchParams(window.location.search);
- if (params.has('enforce_oidc_login')) {
- onAuthenticateUsingOidc();
- }
- }, [onAuthenticateUsingOidc]);
-
return (
@@ -254,10 +249,12 @@ const Login = React.memo(
);
Login.propTypes = {
+ /* eslint-disable react/forbid-prop-types */
defaultData: PropTypes.object.isRequired,
+ /* eslint-enable react/forbid-prop-types */
isSubmitting: PropTypes.bool.isRequired,
isSubmittingUsingOidc: PropTypes.bool.isRequired,
- error: PropTypes.object,
+ error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
withOidc: PropTypes.bool.isRequired,
isOidcEnforced: PropTypes.bool.isRequired,
onAuthenticate: PropTypes.func.isRequired,
diff --git a/client/src/sagas/login/services/router.js b/client/src/sagas/login/services/router.js
index 70c8bfd7..06a0c00f 100644
--- a/client/src/sagas/login/services/router.js
+++ b/client/src/sagas/login/services/router.js
@@ -1,7 +1,7 @@
import { call, put, select, take } from 'redux-saga/effects';
import { push } from '../../../lib/redux-router';
-import { authenticateUsingOidcCallback } from './login';
+import { authenticateUsingOidc, authenticateUsingOidcCallback } from './login';
import selectors from '../../../selectors';
import ActionTypes from '../../../constants/ActionTypes';
import Paths from '../../../constants/Paths';
@@ -29,17 +29,33 @@ export function* handleLocationChange() {
yield call(goToLogin);
break;
- case Paths.OIDC_CALLBACK: {
- const isInitializing = yield select(selectors.selectIsInitializing);
+ default:
+ }
- if (isInitializing) {
- yield take(ActionTypes.LOGIN_INITIALIZE);
+ const isInitializing = yield select(selectors.selectIsInitializing);
+
+ if (isInitializing) {
+ yield take(ActionTypes.LOGIN_INITIALIZE);
+ }
+
+ switch (pathsMatch.pattern.path) {
+ case Paths.LOGIN: {
+ const oidcConfig = yield select(selectors.selectOidcConfig);
+
+ if (oidcConfig) {
+ const params = new URLSearchParams(window.location.search);
+
+ if (params.has('authenticateWithOidc')) {
+ yield call(authenticateUsingOidc);
+ }
}
- yield call(authenticateUsingOidcCallback);
-
break;
}
+ case Paths.OIDC_CALLBACK:
+ yield call(authenticateUsingOidcCallback);
+
+ break;
default:
}
}