Fix password validation; add autocomplete attributes (#7896)

- Fixes https://github.com/enso-org/cloud-v2/issues/690
- Fixes password validation never becoming successful after failing once

Other changes:
- Add autocomplete attributes (Chrome said I should so 🤷)

# Important Notes
None
This commit is contained in:
somebody1234 2023-09-26 23:02:16 +10:00 committed by GitHub
parent fbfaeb5530
commit 2ad19a5366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 0 deletions

View File

@ -57,6 +57,7 @@ export default function ForgotPassword() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}

View File

@ -48,6 +48,7 @@ export default function Input(props: InputProps) {
}
const currentTarget = event.currentTarget
if (error != null) {
currentTarget.setCustomValidity('')
currentTarget.setCustomValidity(
currentTarget.checkValidity() ||
shouldReportValidityRef?.current === false

View File

@ -113,6 +113,7 @@ export default function Login() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
@ -137,6 +138,7 @@ export default function Login() {
id="password"
type="password"
name="password"
autoComplete="current-password"
placeholder="Password"
pattern={validation.PASSWORD_PATTERN}
error={validation.PASSWORD_ERROR}

View File

@ -75,6 +75,7 @@ export default function Registration() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
@ -98,6 +99,7 @@ export default function Registration() {
id="password"
type="password"
name="password"
autoComplete="new-password"
placeholder="Password"
pattern={validation.PASSWORD_PATTERN}
error={validation.PASSWORD_ERROR}
@ -123,6 +125,7 @@ export default function Registration() {
id="password_confirmation"
type="password"
name="password_confirmation"
autoComplete="new-password"
placeholder="Confirm Password"
pattern={string.regexEscape(password)}
error={validation.CONFIRM_PASSWORD_ERROR}

View File

@ -86,6 +86,7 @@ export default function ResetPassword() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
@ -108,6 +109,7 @@ export default function ResetPassword() {
id="code"
type="text"
name="code"
autoComplete="one-time-code"
placeholder="Confirmation Code"
value={code}
setValue={setCode}
@ -131,6 +133,7 @@ export default function ResetPassword() {
id="new_password"
type="password"
name="new_password"
autoComplete="new-password"
placeholder="New Password"
pattern={validation.PASSWORD_PATTERN}
error={validation.PASSWORD_ERROR}
@ -156,6 +159,7 @@ export default function ResetPassword() {
id="new_password_confirm"
type="password"
name="new_password_confirm"
autoComplete="new-password"
placeholder="Confirm New Password"
pattern={string.regexEscape(newPassword)}
error={validation.CONFIRM_PASSWORD_ERROR}

View File

@ -52,6 +52,7 @@ export default function SetUsername() {
id="username"
type="text"
name="username"
autoComplete="off"
placeholder="Username"
value={username}
setValue={setUsername}

View File

@ -63,6 +63,7 @@ export default function ChangePasswordModal() {
id="old_password"
type="password"
name="old_password"
autoComplete="current-password"
placeholder="Old Password"
pattern={validation.PASSWORD_PATTERN}
error={validation.PASSWORD_ERROR}
@ -84,6 +85,7 @@ export default function ChangePasswordModal() {
id="new_password"
type="password"
name="new_password"
autoComplete="new-password"
placeholder="New Password"
pattern={validation.PASSWORD_PATTERN}
error={validation.PASSWORD_ERROR}
@ -105,6 +107,7 @@ export default function ChangePasswordModal() {
id="confirm_new_password"
type="password"
name="confirm_new_password"
autoComplete="new-password"
placeholder="Confirm New Password"
pattern={string.regexEscape(newPassword)}
error={validation.CONFIRM_PASSWORD_ERROR}