1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-11-15 03:50:11 +01:00

fix: disable email login if ldap is enabled

This commit is contained in:
Elias Schneider 2024-09-18 23:32:09 +02:00
parent 67a0fc6ea5
commit d9cfe697d6
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C
2 changed files with 14 additions and 3 deletions

View File

@ -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 }) => {
})}
>
<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

View File

@ -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