From d9cfe697d66e9db7bfbc2252b3700580793ce9bb Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Wed, 18 Sep 2024 23:32:09 +0200 Subject: [PATCH] fix: disable email login if ldap is enabled --- frontend/src/components/auth/SignInForm.tsx | 16 +++++++++++++--- frontend/src/i18n/translations/en-US.ts | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/auth/SignInForm.tsx b/frontend/src/components/auth/SignInForm.tsx index 1dc16001e..09935b60b 100644 --- a/frontend/src/components/auth/SignInForm.tsx +++ b/frontend/src/components/auth/SignInForm.tsx @@ -80,7 +80,9 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => { useState(false); const validationSchema = yup.object().shape({ - emailOrUsername: yup.string().required(t("common.error.field-required")), + emailOrUsername: config.get("ldap.enabled") + ? yup.string().matches(/^[^@]+$/, t("signIn.error.invalid-username")) + : yup.string().required(t("common.error.field-required")), password: yup .string() .min(8, t("common.error.too-short", { length: 8 })) @@ -172,8 +174,16 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => { })} >