Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.

Commit d9cfe69

Browse files
committed
fix: disable email login if ldap is enabled
1 parent 67a0fc6 commit d9cfe69

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

frontend/src/components/auth/SignInForm.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
8080
useState(false);
8181

8282
const validationSchema = yup.object().shape({
83-
emailOrUsername: yup.string().required(t("common.error.field-required")),
83+
emailOrUsername: config.get("ldap.enabled")
84+
? yup.string().matches(/^[^@]+$/, t("signIn.error.invalid-username"))
85+
: yup.string().required(t("common.error.field-required")),
8486
password: yup
8587
.string()
8688
.min(8, t("common.error.too-short", { length: 8 }))
@@ -172,8 +174,16 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
172174
})}
173175
>
174176
<TextInput
175-
label={t("signin.input.email-or-username")}
176-
placeholder={t("signin.input.email-or-username.placeholder")}
177+
label={
178+
config.get("ldap.enabled")
179+
? t("signup.input.username")
180+
: t("signin.input.email-or-username")
181+
}
182+
placeholder={
183+
config.get("ldap.enabled")
184+
? t("signup.input.username.placeholder")
185+
: t("signin.input.email-or-username.placeholder")
186+
}
177187
{...form.getInputProps("emailOrUsername")}
178188
/>
179189
<PasswordInput

frontend/src/i18n/translations/en-US.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default {
5050
"signIn.oauth.microsoft": "Microsoft",
5151
"signIn.oauth.discord": "Discord",
5252
"signIn.oauth.oidc": "OpenID",
53+
"signIn.error.invalid-username": "Invalid username",
5354

5455
// END /auth/signin
5556

0 commit comments

Comments
 (0)