Skip to content

Commit

Permalink
Fix password validation; add autocomplete attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed Sep 26, 2023
1 parent f8c4f9e commit 5ba85f8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function ForgotPassword() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default function Login() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default function Registration() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
Expand All @@ -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}
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default function ResetPassword() {
id="email"
type="email"
name="email"
autoComplete="email"
placeholder="E-Mail Address"
value={email}
setValue={setEmail}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default function SetUsername() {
id="username"
type="text"
name="username"
autoComplete="off"
placeholder="Username"
value={username}
setValue={setUsername}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand Down

0 comments on commit 5ba85f8

Please sign in to comment.