Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib/elements/forms/inputPassword.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let required = false;
export let disabled = false;
export let autofocus = false;
export let autocomplete = false;
export let autocomplete: boolean | string = false;
export let minlength = 8;
export let maxlength: number = null;
export let leadingIcon: ComponentType | undefined = undefined;
Expand Down Expand Up @@ -47,7 +47,11 @@
{leadingIcon}
state={error ? 'error' : 'default'}
autofocus={autofocus || undefined}
autocomplete={autocomplete ? 'on' : 'off'}
autocomplete={typeof autocomplete === 'string'
? (autocomplete as HTMLInputElement['autocomplete'])
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The type assertion as HTMLInputElement['autocomplete'] is unnecessary since TypeScript can infer the type when autocomplete is a string. Consider removing the type assertion for cleaner code.

Suggested change
? (autocomplete as HTMLInputElement['autocomplete'])
? autocomplete

Copilot uses AI. Check for mistakes.

: autocomplete
? 'on'
: 'off'}
helper={helper || error}
on:invalid={handleInvalid}
bind:value>
Expand Down
14 changes: 14 additions & 0 deletions src/routes/(public)/recover/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
let email: string;
let userId: string;
let secret: string;
let userEmail: string;
let password: string;
let confirmPassword: string;
onMount(() => {
userId = page.url.searchParams.get('userId');
secret = page.url.searchParams.get('secret');
userEmail = page.url.searchParams.get('email') || '';
});
async function recover() {
Expand Down Expand Up @@ -76,18 +78,30 @@
{#if userId && secret}
<Form onSubmit={setPassword}>
<Layout.Stack>
<!-- hidden email input for password managers -->
<input
type="email"
name="email"
value={userEmail}
style="position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
tabindex="-1"
autocomplete="username"
aria-hidden="true" />
Comment on lines +82 to +89
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using inline styles for hiding elements is not recommended. Consider using CSS classes or data attributes for better maintainability and consistency with the project's styling approach.

Copilot uses AI. Check for mistakes.


<InputPassword
label="New password"
placeholder="Enter password"
id="password"
autofocus={true}
required={true}
autocomplete="new-password"
bind:value={password} />
<InputPassword
label="Confirm password"
placeholder="Confirm password"
id="confirm-password"
required={true}
autocomplete="new-password"
bind:value={confirmPassword} />

<Button fullWidth submit>Update</Button>
Expand Down