Expand shared profile and about dialogs
Lint / Lint (Go) (push) Successful in 17s
Lint / Lint (Python) (push) Successful in 9s
Tests / Test (Node/Svelte) (push) Successful in 13s
Tests / Test (Go) (push) Successful in 17s
Tests / Test (Python) (push) Successful in 9s
Lint / Lint (Node/Svelte) (push) Successful in 14s
Lint / Lint (Go) (push) Successful in 17s
Lint / Lint (Python) (push) Successful in 9s
Tests / Test (Node/Svelte) (push) Successful in 13s
Tests / Test (Go) (push) Successful in 17s
Tests / Test (Python) (push) Successful in 9s
Lint / Lint (Node/Svelte) (push) Successful in 14s
This commit is contained in:
1 parent
d134d6626a
commit
c95865dbe2
3 files changed
+44
-1
No files matched your search
@@ -17,6 +17,8 @@
|
||||
|
||||
let username = $state('');
|
||||
let email = $state('');
|
||||
let password = $state('');
|
||||
let confirmPassword = $state('');
|
||||
let error = $state('');
|
||||
let saving = $state(false);
|
||||
|
||||
@@ -24,6 +26,8 @@
|
||||
if (open) {
|
||||
username = currentUsername;
|
||||
email = currentEmail;
|
||||
password = '';
|
||||
confirmPassword = '';
|
||||
error = '';
|
||||
}
|
||||
});
|
||||
@@ -32,6 +36,11 @@
|
||||
event.preventDefault();
|
||||
error = '';
|
||||
|
||||
if (password && password !== confirmPassword) {
|
||||
error = 'Passwords do not match.';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!onSave) {
|
||||
error = 'The application has not configured its profile update handler.';
|
||||
return;
|
||||
@@ -39,7 +48,7 @@
|
||||
|
||||
saving = true;
|
||||
try {
|
||||
await onSave({ username, email });
|
||||
await onSave({ username, email, password: password || undefined });
|
||||
open = false;
|
||||
} catch (caught) {
|
||||
error = caught instanceof Error ? caught.message : 'Profile update failed.';
|
||||
@@ -68,6 +77,32 @@
|
||||
<input autocomplete="email" class="sc-input" required type="email" bind:value={email} />
|
||||
</label>
|
||||
|
||||
<label class="sc-field">
|
||||
<span class="sc-label">New password</span>
|
||||
<input
|
||||
autocomplete="new-password"
|
||||
class="sc-input"
|
||||
minlength="8"
|
||||
placeholder="Leave blank to keep the current password"
|
||||
type="password"
|
||||
bind:value={password}
|
||||
/>
|
||||
</label>
|
||||
|
||||
{#if password}
|
||||
<label class="sc-field">
|
||||
<span class="sc-label">Confirm new password</span>
|
||||
<input
|
||||
autocomplete="new-password"
|
||||
class="sc-input"
|
||||
minlength="8"
|
||||
required
|
||||
type="password"
|
||||
bind:value={confirmPassword}
|
||||
/>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
{#if error}
|
||||
<p aria-live="polite" class="sc-error">{error}</p>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user