add login username validation & prevent safari to capitalize
This commit is contained in:
parent
7d0990fe89
commit
26d94c4ba7
@ -23,6 +23,7 @@ import { BackendStateHandler } from "../hooks/backend.js";
|
|||||||
import { bankUiSettings } from "../settings.js";
|
import { bankUiSettings } from "../settings.js";
|
||||||
import { getBankBackendBaseUrl, undefinedIfEmpty } from "../utils.js";
|
import { getBankBackendBaseUrl, undefinedIfEmpty } from "../utils.js";
|
||||||
import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js";
|
import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js";
|
||||||
|
import { USERNAME_REGEX } from "./RegistrationPage.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect and submit login data.
|
* Collect and submit login data.
|
||||||
@ -38,7 +39,11 @@ export function LoginForm(): VNode {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const errors = undefinedIfEmpty({
|
const errors = undefinedIfEmpty({
|
||||||
username: !username ? i18n.str`Missing username` : undefined,
|
username: !username
|
||||||
|
? i18n.str`Missing username`
|
||||||
|
: !USERNAME_REGEX.test(username)
|
||||||
|
? i18n.str`Use only letter and numbers starting with a lower case letter`
|
||||||
|
: undefined,
|
||||||
password: !password ? i18n.str`Missing password` : undefined,
|
password: !password ? i18n.str`Missing password` : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -50,6 +55,9 @@ export function LoginForm(): VNode {
|
|||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
autoCapitalize="none"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoComplete="off"
|
||||||
>
|
>
|
||||||
<div class="pure-form">
|
<div class="pure-form">
|
||||||
<h2>{i18n.str`Please login!`}</h2>
|
<h2>{i18n.str`Please login!`}</h2>
|
||||||
|
@ -80,6 +80,9 @@ export function PaytoWireTransferForm({
|
|||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
autoCapitalize="none"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoComplete="off"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<label for="iban">{i18n.str`Receiver IBAN:`}</label>
|
<label for="iban">{i18n.str`Receiver IBAN:`}</label>
|
||||||
@ -249,7 +252,16 @@ export function PaytoWireTransferForm({
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{i18n.str`Transfer money to account identified by payto:// URI:`}</p>
|
<p>{i18n.str`Transfer money to account identified by payto:// URI:`}</p>
|
||||||
<div class="pure-form" name="payto-form">
|
<form
|
||||||
|
class="pure-form"
|
||||||
|
name="payto-form"
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
}}
|
||||||
|
autoCapitalize="none"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoComplete="off"
|
||||||
|
>
|
||||||
<p>
|
<p>
|
||||||
<label for="address">{i18n.str`payto URI:`}</label>
|
<label for="address">{i18n.str`payto URI:`}</label>
|
||||||
<input
|
<input
|
||||||
@ -271,7 +283,7 @@ export function PaytoWireTransferForm({
|
|||||||
isDirty={rawPaytoInput !== undefined}
|
isDirty={rawPaytoInput !== undefined}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<div class="hint">
|
<div style={{ fontSize: "small", marginTop: 4 }}>
|
||||||
Hint:
|
Hint:
|
||||||
<code>
|
<code>
|
||||||
payto://iban/[receiver-iban]?message=[subject]&amount=[{currency}
|
payto://iban/[receiver-iban]?message=[subject]&amount=[{currency}
|
||||||
@ -322,7 +334,7 @@ export function PaytoWireTransferForm({
|
|||||||
{i18n.str`Use wire-transfer form?`}
|
{i18n.str`Use wire-transfer form?`}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ export function RegistrationPage(): VNode {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const usernameRegex = /^[a-z][a-zA-Z0-9]+$/;
|
export const USERNAME_REGEX = /^[a-z][a-zA-Z0-9]+$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect and submit registration data.
|
* Collect and submit registration data.
|
||||||
@ -64,12 +64,12 @@ function RegistrationForm(): VNode {
|
|||||||
const errors = undefinedIfEmpty({
|
const errors = undefinedIfEmpty({
|
||||||
username: !username
|
username: !username
|
||||||
? i18n.str`Missing username`
|
? i18n.str`Missing username`
|
||||||
: !usernameRegex.test(username)
|
: !USERNAME_REGEX.test(username)
|
||||||
? i18n.str`Use only letter and numbers starting with a lower case letter`
|
? i18n.str`Use only letter and numbers starting with a lower case letter`
|
||||||
: undefined,
|
: undefined,
|
||||||
password: !password
|
password: !password
|
||||||
? i18n.str`Missing password`
|
? i18n.str`Missing password`
|
||||||
: !usernameRegex.test(password)
|
: !USERNAME_REGEX.test(password)
|
||||||
? i18n.str`Use only letter and numbers starting with a lower case letter`
|
? i18n.str`Use only letter and numbers starting with a lower case letter`
|
||||||
: undefined,
|
: undefined,
|
||||||
repeatPassword: !repeatPassword
|
repeatPassword: !repeatPassword
|
||||||
|
Loading…
Reference in New Issue
Block a user