Skip to content

Commit

Permalink
fix: disable email login if ldap is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Sep 18, 2024
1 parent 67a0fc6 commit d9cfe69
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions frontend/src/components/auth/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down Expand Up @@ -172,8 +174,16 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
})}
>
<TextInput
label={t("signin.input.email-or-username")}
placeholder={t("signin.input.email-or-username.placeholder")}
label={
config.get("ldap.enabled")
? t("signup.input.username")
: t("signin.input.email-or-username")
}
placeholder={
config.get("ldap.enabled")
? t("signup.input.username.placeholder")
: t("signin.input.email-or-username.placeholder")
}
{...form.getInputProps("emailOrUsername")}
/>
<PasswordInput
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/translations/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default {
"signIn.oauth.microsoft": "Microsoft",
"signIn.oauth.discord": "Discord",
"signIn.oauth.oidc": "OpenID",
"signIn.error.invalid-username": "Invalid username",

// END /auth/signin

Expand Down

0 comments on commit d9cfe69

Please sign in to comment.