diff --git a/frontend/src/views/Login/components/InitialStep/InitialStep.tsx b/frontend/src/views/Login/components/InitialStep/InitialStep.tsx index 83615ccf5..d97126f67 100644 --- a/frontend/src/views/Login/components/InitialStep/InitialStep.tsx +++ b/frontend/src/views/Login/components/InitialStep/InitialStep.tsx @@ -62,6 +62,12 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }: } }, []); + const shouldDisplayLoginMethod = useCallback( + (method: LoginMethod) => + !config.enabledLoginMethods || config.enabledLoginMethods.includes(method), + [config] + ); + const handleLogin = async (e: FormEvent) => { e.preventDefault(); try { @@ -163,188 +169,173 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:

Login to Infisical

- {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.GOOGLE) && ( -
- -
- ))} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.GITHUB) && ( -
- +
+ )} + {shouldDisplayLoginMethod(LoginMethod.GITHUB) && ( +
+ -
- ))} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.GITLAB) && ( -
- +
+ )} + {shouldDisplayLoginMethod(LoginMethod.GITLAB) && ( +
+ -
- ))} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.SAML) && ( -
- -
- ))} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.OIDC) && ( -
- -
- ))} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.LDAP) && ( -
- -
- ))} + window.close(); + }} + leftIcon={} + className="mx-0 h-10 w-full" + > + Continue with GitLab + + + )} + {shouldDisplayLoginMethod(LoginMethod.SAML) && ( +
+ +
+ )} + {shouldDisplayLoginMethod(LoginMethod.OIDC) && ( +
+ +
+ )} + {shouldDisplayLoginMethod(LoginMethod.LDAP) && ( +
+ +
+ )} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.length > 1 && - config.enabledLoginMethods.includes(LoginMethod.EMAIL) && ( -
-
- or -
-
- ))} - {!config.enabledLoginMethods || - (config.enabledLoginMethods.includes(LoginMethod.EMAIL) && ( - <> -
- setEmail(e.target.value)} - type="email" - placeholder="Enter your email..." - isRequired - autoComplete="username" - className="h-10" + {shouldDisplayLoginMethod(LoginMethod.EMAIL) && config.enabledLoginMethods.length > 1 && ( +
+
+ or +
+
+ )} + {shouldDisplayLoginMethod(LoginMethod.EMAIL) && ( + <> +
+ setEmail(e.target.value)} + type="email" + placeholder="Enter your email..." + isRequired + autoComplete="username" + className="h-10" + /> +
+
+ setPassword(e.target.value)} + type="password" + placeholder="Enter your password..." + isRequired + autoComplete="current-password" + id="current-password" + className="select:-webkit-autofill:focus h-10" + /> +
+ {shouldShowCaptcha && ( +
+ setCaptchaToken(token)} + ref={captchaRef} />
-
- setPassword(e.target.value)} - type="password" - placeholder="Enter your password..." - isRequired - autoComplete="current-password" - id="current-password" - className="select:-webkit-autofill:focus h-10" - /> -
- {shouldShowCaptcha && ( -
- setCaptchaToken(token)} - ref={captchaRef} - /> -
- )} -
- -
- - ))} + )} +
+ +
+ + )} {!isLoading && loginError && } {config.allowSignUp ? (