removing password regex
This commit is contained in:
parent
7d26a6a56b
commit
7f7d1a769f
@ -20,7 +20,7 @@ import { useEffect, useRef, useState } from "preact/hooks";
|
|||||||
import { useBackendContext } from "../context/backend.js";
|
import { useBackendContext } from "../context/backend.js";
|
||||||
import { bankUiSettings } from "../settings.js";
|
import { bankUiSettings } from "../settings.js";
|
||||||
import { undefinedIfEmpty } from "../utils.js";
|
import { undefinedIfEmpty } from "../utils.js";
|
||||||
import { PASSWORD_REGEX, USERNAME_REGEX } from "./RegistrationPage.js";
|
import { USERNAME_REGEX } from "./RegistrationPage.js";
|
||||||
import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js";
|
import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +32,7 @@ export function LoginForm({ onRegister }: { onRegister: () => void }): VNode {
|
|||||||
const [password, setPassword] = useState<string | undefined>();
|
const [password, setPassword] = useState<string | undefined>();
|
||||||
const { i18n } = useTranslationContext();
|
const { i18n } = useTranslationContext();
|
||||||
const ref = useRef<HTMLInputElement>(null);
|
const ref = useRef<HTMLInputElement>(null);
|
||||||
useEffect(() => {
|
useEffect(function focusInput() {
|
||||||
ref.current?.focus();
|
ref.current?.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -42,17 +42,12 @@ export function LoginForm({ onRegister }: { onRegister: () => void }): VNode {
|
|||||||
: !USERNAME_REGEX.test(username)
|
: !USERNAME_REGEX.test(username)
|
||||||
? i18n.str`Use letters and numbers only, and start with a lowercase letter`
|
? i18n.str`Use letters and numbers only, and start with a lowercase letter`
|
||||||
: undefined,
|
: undefined,
|
||||||
password: !password
|
password: !password ? i18n.str`Missing password` : undefined,
|
||||||
? i18n.str`Missing password`
|
|
||||||
: !PASSWORD_REGEX.test(password)
|
|
||||||
? i18n.str`Use letters and numbers only, and start with a lowercase letter or number`
|
|
||||||
: undefined,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<h1 class="nav">{i18n.str`Welcome to ${bankUiSettings.bankName}!`}</h1>
|
<h1 class="nav">{i18n.str`Welcome to ${bankUiSettings.bankName}!`}</h1>
|
||||||
|
|
||||||
<div class="login-div">
|
<div class="login-div">
|
||||||
<form
|
<form
|
||||||
class="login-form"
|
class="login-form"
|
||||||
|
@ -46,7 +46,6 @@ export function RegistrationPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const USERNAME_REGEX = /^[a-z][a-zA-Z0-9]*$/;
|
export const USERNAME_REGEX = /^[a-z][a-zA-Z0-9]*$/;
|
||||||
export const PASSWORD_REGEX = /^[a-z0-9][a-zA-Z0-9]*$/;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect and submit registration data.
|
* Collect and submit registration data.
|
||||||
@ -72,11 +71,7 @@ function RegistrationForm({
|
|||||||
: !USERNAME_REGEX.test(username)
|
: !USERNAME_REGEX.test(username)
|
||||||
? i18n.str`Use letters and numbers only, and start with a lowercase letter`
|
? i18n.str`Use letters and numbers only, and start with a lowercase letter`
|
||||||
: undefined,
|
: undefined,
|
||||||
password: !password
|
password: !password ? i18n.str`Missing password` : undefined,
|
||||||
? i18n.str`Missing password`
|
|
||||||
: !PASSWORD_REGEX.test(password)
|
|
||||||
? i18n.str`Use letters and numbers only, and start with a lowercase letter or number`
|
|
||||||
: undefined,
|
|
||||||
repeatPassword: !repeatPassword
|
repeatPassword: !repeatPassword
|
||||||
? i18n.str`Missing password`
|
? i18n.str`Missing password`
|
||||||
: repeatPassword !== password
|
: repeatPassword !== password
|
||||||
|
Loading…
Reference in New Issue
Block a user