Disable login/register autofill on auth fields.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
4a516e31db
commit
8008ea4db1
@@ -211,12 +211,12 @@ function AuthFormInner() {
|
|||||||
name="cellNumber"
|
name="cellNumber"
|
||||||
type="tel"
|
type="tel"
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
autoComplete="tel"
|
autoComplete="off"
|
||||||
placeholder="09123456789"
|
placeholder="09123456789"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
pattern="09[0-9]{9}"
|
pattern="09[0-9]{9}"
|
||||||
required={isLogin}
|
required={isLogin}
|
||||||
defaultValue={pendingCell}
|
defaultValue={pendingCell || undefined}
|
||||||
/>
|
/>
|
||||||
{loginMethod === "password" ? (
|
{loginMethod === "password" ? (
|
||||||
<Field
|
<Field
|
||||||
@@ -224,7 +224,7 @@ function AuthFormInner() {
|
|||||||
label="رمز عبور"
|
label="رمز عبور"
|
||||||
name="password"
|
name="password"
|
||||||
type="password"
|
type="password"
|
||||||
autoComplete="current-password"
|
autoComplete="off"
|
||||||
placeholder="••••••••"
|
placeholder="••••••••"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
required={isLogin}
|
required={isLogin}
|
||||||
@@ -237,6 +237,7 @@ function AuthFormInner() {
|
|||||||
name="code"
|
name="code"
|
||||||
type="text"
|
type="text"
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
|
autoComplete="one-time-code"
|
||||||
placeholder="123456"
|
placeholder="123456"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
required
|
required
|
||||||
@@ -320,7 +321,7 @@ function AuthFormInner() {
|
|||||||
label="نام"
|
label="نام"
|
||||||
name="firstName"
|
name="firstName"
|
||||||
type="text"
|
type="text"
|
||||||
autoComplete="given-name"
|
autoComplete="off"
|
||||||
required={!isLogin}
|
required={!isLogin}
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
@@ -328,7 +329,7 @@ function AuthFormInner() {
|
|||||||
label="نام خانوادگی"
|
label="نام خانوادگی"
|
||||||
name="lastName"
|
name="lastName"
|
||||||
type="text"
|
type="text"
|
||||||
autoComplete="family-name"
|
autoComplete="off"
|
||||||
required={!isLogin}
|
required={!isLogin}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -338,6 +339,7 @@ function AuthFormInner() {
|
|||||||
name="cellNumber"
|
name="cellNumber"
|
||||||
type="tel"
|
type="tel"
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
|
autoComplete="off"
|
||||||
placeholder="09123456789"
|
placeholder="09123456789"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
pattern="09[0-9]{9}"
|
pattern="09[0-9]{9}"
|
||||||
@@ -373,8 +375,9 @@ function AuthFormInner() {
|
|||||||
label="شماره موبایل"
|
label="شماره موبایل"
|
||||||
name="cellNumber"
|
name="cellNumber"
|
||||||
type="tel"
|
type="tel"
|
||||||
|
autoComplete="off"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
defaultValue={pendingCell}
|
defaultValue={pendingCell || undefined}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
@@ -383,6 +386,7 @@ function AuthFormInner() {
|
|||||||
name="code"
|
name="code"
|
||||||
type="text"
|
type="text"
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
|
autoComplete="one-time-code"
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
required
|
required
|
||||||
minLength={4}
|
minLength={4}
|
||||||
@@ -474,7 +478,11 @@ function AuthPanel({
|
|||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<h1 className="mb-2 text-xl font-medium text-ink sm:text-2xl">{title}</h1>
|
<h1 className="mb-2 text-xl font-medium text-ink sm:text-2xl">{title}</h1>
|
||||||
<p className="mb-8 max-w-sm text-sm leading-7 text-muted">{subtitle}</p>
|
<p className="mb-8 max-w-sm text-sm leading-7 text-muted">{subtitle}</p>
|
||||||
<form onSubmit={onSubmit} className="flex w-full flex-col gap-4">
|
<form
|
||||||
|
onSubmit={onSubmit}
|
||||||
|
className="flex w-full flex-col gap-4"
|
||||||
|
autoComplete="off"
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -484,17 +492,31 @@ function AuthPanel({
|
|||||||
function Field({
|
function Field({
|
||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
|
autoComplete = "off",
|
||||||
|
onFocus,
|
||||||
...props
|
...props
|
||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
} & InputHTMLAttributes<HTMLInputElement>) {
|
} & InputHTMLAttributes<HTMLInputElement>) {
|
||||||
|
const [unlockAutofill, setUnlockAutofill] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<label htmlFor={id} className="auth-label">
|
<label htmlFor={id} className="auth-label">
|
||||||
{label}
|
{label}
|
||||||
</label>
|
</label>
|
||||||
<input id={id} className="auth-input" {...props} />
|
<input
|
||||||
|
id={id}
|
||||||
|
className="auth-input"
|
||||||
|
{...props}
|
||||||
|
autoComplete={autoComplete}
|
||||||
|
readOnly={!unlockAutofill}
|
||||||
|
onFocus={(event) => {
|
||||||
|
if (!unlockAutofill) setUnlockAutofill(true);
|
||||||
|
onFocus?.(event);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user