sandcms 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/admin/Account.svelte +284 -83
- package/dist/admin/ApiKeys.svelte +146 -79
- package/dist/admin/AssetAttachment.svelte +9 -9
- package/dist/admin/BlueprintFields.svelte +20 -2
- package/dist/admin/BlueprintFields.svelte.d.ts +2 -0
- package/dist/admin/Collection.svelte +111 -54
- package/dist/admin/Dashboard.svelte +3 -37
- package/dist/admin/DateField.svelte +75 -0
- package/dist/admin/DateField.svelte.d.ts +11 -0
- package/dist/admin/Editor.svelte +71 -65
- package/dist/admin/Fields.svelte +24 -16
- package/dist/admin/FocusPicker.svelte +1 -2
- package/dist/admin/Gallery.svelte +0 -1
- package/dist/admin/GlobalSearch.svelte +54 -26
- package/dist/admin/HoverHint.svelte +37 -0
- package/dist/admin/HoverHint.svelte.d.ts +8 -0
- package/dist/admin/Inbox.svelte +6 -11
- package/dist/admin/LinkField.svelte +129 -64
- package/dist/admin/Login.svelte +0 -1
- package/dist/admin/MediaLibrary.svelte +61 -50
- package/dist/admin/MediaPicker.svelte +57 -42
- package/dist/admin/NotificationSettings.svelte +35 -27
- package/dist/admin/RichText.svelte +2 -2
- package/dist/admin/RowMenu.svelte +28 -0
- package/dist/admin/RowMenu.svelte.d.ts +10 -0
- package/dist/admin/SearchList.svelte +51 -14
- package/dist/admin/Shell.svelte +64 -29
- package/dist/admin/Users.svelte +106 -50
- package/dist/admin/client.d.ts +2 -0
- package/dist/admin/client.js +18 -0
- package/dist/admin/components/ui/calendar/calendar-caption.svelte +76 -0
- package/dist/admin/components/ui/calendar/calendar-caption.svelte.d.ts +19 -0
- package/dist/admin/components/ui/calendar/calendar-cell.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-cell.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-day.svelte +33 -0
- package/dist/admin/components/ui/calendar/calendar-day.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-body.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-body.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-head.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-head.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-row.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-row.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid.svelte +16 -0
- package/dist/admin/components/ui/calendar/calendar-grid.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-head-cell.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-head-cell.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-header.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-header.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-heading.svelte +16 -0
- package/dist/admin/components/ui/calendar/calendar-heading.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-month-select.svelte +48 -0
- package/dist/admin/components/ui/calendar/calendar-month-select.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-month.svelte +15 -0
- package/dist/admin/components/ui/calendar/calendar-month.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-months.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-months.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-nav.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-nav.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-next-button.svelte +37 -0
- package/dist/admin/components/ui/calendar/calendar-next-button.svelte.d.ts +8 -0
- package/dist/admin/components/ui/calendar/calendar-prev-button.svelte +37 -0
- package/dist/admin/components/ui/calendar/calendar-prev-button.svelte.d.ts +8 -0
- package/dist/admin/components/ui/calendar/calendar-year-select.svelte +47 -0
- package/dist/admin/components/ui/calendar/calendar-year-select.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar.svelte +115 -0
- package/dist/admin/components/ui/calendar/calendar.svelte.d.ts +21 -0
- package/dist/admin/components/ui/calendar/index.d.ts +19 -0
- package/dist/admin/components/ui/calendar/index.js +21 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +46 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +9 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-content.svelte +31 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-portal.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +36 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +23 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +5 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +31 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/index.d.ts +18 -0
- package/dist/admin/components/ui/dropdown-menu/index.js +18 -0
- package/dist/admin/components/ui/input-otp/index.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/index.js +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-group.svelte +23 -0
- package/dist/admin/components/ui/input-otp/input-otp-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-separator.svelte +27 -0
- package/dist/admin/components/ui/input-otp/input-otp-separator.svelte.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-slot.svelte +29 -0
- package/dist/admin/components/ui/input-otp/input-otp-slot.svelte.d.ts +4 -0
- package/dist/admin/components/ui/input-otp/input-otp.svelte +24 -0
- package/dist/admin/components/ui/input-otp/input-otp.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/index.d.ts +9 -0
- package/dist/admin/components/ui/popover/index.js +11 -0
- package/dist/admin/components/ui/popover/popover-close.svelte +7 -0
- package/dist/admin/components/ui/popover/popover-close.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/popover-content.svelte +31 -0
- package/dist/admin/components/ui/popover/popover-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/popover/popover-description.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-header.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-portal.svelte +7 -0
- package/dist/admin/components/ui/popover/popover-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/popover/popover-title.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-trigger.svelte +17 -0
- package/dist/admin/components/ui/popover/popover-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/popover.svelte +7 -0
- package/dist/admin/components/ui/popover/popover.svelte.d.ts +3 -0
- package/dist/admin/components/ui/switch/switch.svelte +2 -2
- package/dist/admin/components/ui/tooltip/index.d.ts +6 -0
- package/dist/admin/components/ui/tooltip/index.js +8 -0
- package/dist/admin/components/ui/tooltip/tooltip-content.svelte +48 -0
- package/dist/admin/components/ui/tooltip/tooltip-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-portal.svelte.d.ts +4 -0
- package/dist/admin/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-provider.svelte.d.ts +4 -0
- package/dist/admin/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-trigger.svelte.d.ts +25 -0
- package/dist/admin/components/ui/tooltip/tooltip.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip.svelte.d.ts +25 -0
- package/dist/admin/generated/admin.css +774 -138
- package/dist/admin/slug.d.ts +1 -0
- package/dist/admin/slug.js +6 -0
- package/dist/cli/doctor.js +2 -2
- package/dist/cli/files.js +11 -6
- package/dist/cli/index.js +1 -1
- package/dist/cli/upgrade.js +2 -1
- package/dist/env.d.ts +80 -0
- package/dist/env.js +103 -0
- package/dist/server/admin-load.d.ts +46 -76
- package/dist/server/admin-load.js +98 -24
- package/dist/server/api-pagination.d.ts +2 -0
- package/dist/server/api-pagination.js +51 -7
- package/dist/server/api.js +6 -1
- package/dist/server/auth.d.ts +1 -0
- package/dist/server/auth.js +23 -0
- package/dist/server/cms.d.ts +17 -2
- package/dist/server/cms.js +3 -1
- package/dist/server/content.d.ts +15 -2
- package/dist/server/content.js +72 -30
- package/dist/server/db/migration-data.js +8 -0
- package/dist/server/db/migrations/0007_content_and_job_indexes.sql +2 -0
- package/dist/server/db/migrations/0008_search_text_cache.sql +45 -0
- package/dist/server/db/migrations/meta/0007_snapshot.json +1643 -0
- package/dist/server/db/migrations/meta/0008_snapshot.json +1711 -0
- package/dist/server/db/migrations/meta/_journal.json +14 -0
- package/dist/server/db/schema.d.ts +83 -0
- package/dist/server/db/schema.js +23 -5
- package/dist/server/email/index.d.ts +5 -1
- package/dist/server/email/index.js +12 -11
- package/dist/server/media/runner.js +217 -191
- package/dist/server/media/service.d.ts +6 -0
- package/dist/server/media/service.js +36 -3
- package/dist/server/search.d.ts +2 -0
- package/dist/server/search.js +7 -0
- package/dist/worker/index.js +129 -76
- package/docs/api.md +1 -1
- package/docs/cloudflare.md +1 -1
- package/docs/deployment.md +15 -1
- package/docs/email.md +5 -5
- package/docs/media.md +2 -2
- package/docs/package.md +4 -4
- package/docs/releases.md +20 -0
- package/docs/upgrades.md +40 -1
- package/package.json +9 -3
- package/templates/env.ts +8 -0
- package/templates/integration.ts +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SandCMS
|
|
2
2
|
|
|
3
|
-
**0.6.
|
|
3
|
+
**0.6.3** polishes the admin: tighter layouts, an account menu, link fields edited in a dialog, a calendar date picker, a step-by-step two-factor setup with a QR code, and removing users from the Users page. There is no new database migration or Worker change; stored data and project-owned YAML are preserved. See the [0.6.3 release notes](docs/releases.md#063), [upgrade workflow](docs/upgrades.md#063-upgrade-checklist) and [agent instructions](AGENTS.md).
|
|
4
4
|
|
|
5
5
|
SandCMS embeds a content workspace into a SvelteKit website. Developers own YAML blueprints and public routes; editors manage drafts, publication, images, and form submissions at `/admin`.
|
|
6
6
|
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import * as Card from './components/ui/card/index.js';
|
|
3
|
+
import * as Dialog from './components/ui/dialog/index.js';
|
|
3
4
|
import Notice from './Notice.svelte';
|
|
4
5
|
import ApiKeys from './ApiKeys.svelte';
|
|
5
6
|
import { untrack } from 'svelte';
|
|
6
7
|
import type { AdminData } from './types.js';
|
|
7
|
-
import { authClient, message } from './client.js';
|
|
8
|
+
import { authClient, copyText, message } from './client.js';
|
|
8
9
|
import { Button } from './components/ui/button/index.js';
|
|
9
10
|
import { Input } from './components/ui/input/index.js';
|
|
10
11
|
import { Label } from './components/ui/label/index.js';
|
|
12
|
+
import { Badge } from './components/ui/badge/index.js';
|
|
13
|
+
import ShieldCheck from '@lucide/svelte/icons/shield-check';
|
|
14
|
+
import Copy from '@lucide/svelte/icons/copy';
|
|
15
|
+
import Check from '@lucide/svelte/icons/check';
|
|
16
|
+
import * as InputOTP from './components/ui/input-otp/index.js';
|
|
17
|
+
import QRCode from 'qrcode';
|
|
11
18
|
let { data }: { data: AdminData } = $props();
|
|
12
19
|
let current = $state(''),
|
|
13
20
|
password = $state(''),
|
|
@@ -17,9 +24,35 @@
|
|
|
17
24
|
uri = $state(''),
|
|
18
25
|
codes = $state<string[]>([]),
|
|
19
26
|
enabled = $state(untrack(() => !!data.user?.twoFactorEnabled)),
|
|
27
|
+
setupOpen = $state(false),
|
|
28
|
+
disableOpen = $state(false),
|
|
29
|
+
step = $state(1),
|
|
20
30
|
busy = $state(false),
|
|
21
31
|
error = $state(''),
|
|
22
|
-
notice = $state('')
|
|
32
|
+
notice = $state(''),
|
|
33
|
+
dialogError = $state('');
|
|
34
|
+
const secret = $derived(uri ? (new URL(uri).searchParams.get('secret') ?? '') : '');
|
|
35
|
+
let qrUrl = $state('');
|
|
36
|
+
$effect(() => {
|
|
37
|
+
const target = uri;
|
|
38
|
+
if (!target) {
|
|
39
|
+
qrUrl = '';
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
QRCode.toDataURL(target, { width: 176, margin: 1 }).then((url) => {
|
|
43
|
+
if (target === uri) qrUrl = url;
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
let copied = $state(false);
|
|
47
|
+
async function copySecret() {
|
|
48
|
+
try {
|
|
49
|
+
await copyText(secret);
|
|
50
|
+
copied = true;
|
|
51
|
+
setTimeout(() => (copied = false), 2000);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
dialogError = message(e);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
23
56
|
async function change() {
|
|
24
57
|
busy = true;
|
|
25
58
|
error = '';
|
|
@@ -44,40 +77,62 @@
|
|
|
44
77
|
busy = false;
|
|
45
78
|
}
|
|
46
79
|
}
|
|
47
|
-
|
|
80
|
+
function resetSetup() {
|
|
81
|
+
setupOpen = false;
|
|
82
|
+
step = 1;
|
|
83
|
+
twoFactorPassword = '';
|
|
84
|
+
code = '';
|
|
85
|
+
uri = '';
|
|
86
|
+
codes = [];
|
|
87
|
+
dialogError = '';
|
|
88
|
+
}
|
|
89
|
+
async function startSetup() {
|
|
48
90
|
busy = true;
|
|
49
|
-
|
|
91
|
+
dialogError = '';
|
|
50
92
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} else {
|
|
57
|
-
const r = await authClient.twoFactor.enable({ password: twoFactorPassword });
|
|
58
|
-
if (r.error) throw new Error(r.error.message);
|
|
59
|
-
if (!r.data || !('totpURI' in r.data)) throw new Error('TOTP setup unavailable');
|
|
60
|
-
uri = r.data.totpURI;
|
|
61
|
-
codes = r.data.backupCodes;
|
|
62
|
-
}
|
|
93
|
+
const r = await authClient.twoFactor.enable({ password: twoFactorPassword });
|
|
94
|
+
if (r.error) throw new Error(r.error.message);
|
|
95
|
+
if (!r.data || !('totpURI' in r.data)) throw new Error('TOTP setup unavailable');
|
|
96
|
+
uri = r.data.totpURI;
|
|
97
|
+
codes = r.data.backupCodes;
|
|
63
98
|
twoFactorPassword = '';
|
|
99
|
+
step = 2;
|
|
64
100
|
} catch (e) {
|
|
65
|
-
|
|
101
|
+
dialogError = message(e);
|
|
66
102
|
} finally {
|
|
67
103
|
busy = false;
|
|
68
104
|
}
|
|
69
105
|
}
|
|
70
106
|
async function verify() {
|
|
107
|
+
if (busy) return;
|
|
71
108
|
busy = true;
|
|
72
|
-
|
|
109
|
+
dialogError = '';
|
|
73
110
|
try {
|
|
74
111
|
const r = await authClient.twoFactor.verifyTotp({ code });
|
|
75
112
|
if (r.error) throw new Error(r.error.message);
|
|
76
113
|
enabled = true;
|
|
77
|
-
|
|
78
|
-
notice = 'Two-factor authentication enabled. Keep your recovery codes safe.';
|
|
114
|
+
step = 3;
|
|
79
115
|
} catch (e) {
|
|
80
|
-
|
|
116
|
+
dialogError = message(e);
|
|
117
|
+
} finally {
|
|
118
|
+
busy = false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function finishSetup() {
|
|
122
|
+
resetSetup();
|
|
123
|
+
}
|
|
124
|
+
async function disable() {
|
|
125
|
+
busy = true;
|
|
126
|
+
dialogError = '';
|
|
127
|
+
try {
|
|
128
|
+
const r = await authClient.twoFactor.disable({ password: twoFactorPassword });
|
|
129
|
+
if (r.error) throw new Error(r.error.message);
|
|
130
|
+
enabled = false;
|
|
131
|
+
twoFactorPassword = '';
|
|
132
|
+
disableOpen = false;
|
|
133
|
+
notice = 'Two-factor authentication disabled.';
|
|
134
|
+
} catch (e) {
|
|
135
|
+
dialogError = message(e);
|
|
81
136
|
} finally {
|
|
82
137
|
busy = false;
|
|
83
138
|
}
|
|
@@ -90,11 +145,18 @@
|
|
|
90
145
|
a.click();
|
|
91
146
|
URL.revokeObjectURL(url);
|
|
92
147
|
}
|
|
148
|
+
async function copyCodes() {
|
|
149
|
+
try {
|
|
150
|
+
await copyText(codes.join('\n'));
|
|
151
|
+
notice = 'Recovery codes copied.';
|
|
152
|
+
} catch (e) {
|
|
153
|
+
dialogError = message(e);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
93
156
|
</script>
|
|
94
157
|
|
|
95
158
|
<div class="cms-page-heading">
|
|
96
159
|
<div>
|
|
97
|
-
<div class="cms-eyebrow">YOUR ACCOUNT</div>
|
|
98
160
|
<h1>{data.user?.mustChangePassword ? 'Set your own password' : 'Account & security'}</h1>
|
|
99
161
|
<p class="cms-muted">
|
|
100
162
|
{data.user?.mustChangePassword
|
|
@@ -104,9 +166,9 @@
|
|
|
104
166
|
</div>
|
|
105
167
|
</div>
|
|
106
168
|
{#if error}<Notice error>{error}</Notice>{/if}{#if notice}<Notice>{notice}</Notice>{/if}
|
|
107
|
-
<div class="cms-
|
|
108
|
-
<Card.Root class="cms-detail-card">
|
|
109
|
-
<h2>
|
|
169
|
+
<div class="cms-settings">
|
|
170
|
+
<Card.Root class="cms-detail-card cms-settings-card">
|
|
171
|
+
<div class="cms-settings-header"><h2>Password</h2></div>
|
|
110
172
|
<form
|
|
111
173
|
class="cms-stack"
|
|
112
174
|
onsubmit={(e) => {
|
|
@@ -123,71 +185,210 @@
|
|
|
123
185
|
required
|
|
124
186
|
/>
|
|
125
187
|
</div>
|
|
126
|
-
<div class="cms-
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
188
|
+
<div class="cms-settings-row">
|
|
189
|
+
<div class="cms-field">
|
|
190
|
+
<Label for="new-password">New password</Label><Input
|
|
191
|
+
id="new-password"
|
|
192
|
+
type="password"
|
|
193
|
+
autocomplete="new-password"
|
|
194
|
+
bind:value={password}
|
|
195
|
+
minlength={12}
|
|
196
|
+
maxlength={128}
|
|
197
|
+
required
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="cms-field">
|
|
201
|
+
<Label for="confirm-password">Confirm new password</Label><Input
|
|
202
|
+
id="confirm-password"
|
|
203
|
+
type="password"
|
|
204
|
+
autocomplete="new-password"
|
|
205
|
+
bind:value={confirmation}
|
|
206
|
+
minlength={12}
|
|
207
|
+
required
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
136
210
|
</div>
|
|
137
|
-
<div class="cms-
|
|
138
|
-
<
|
|
139
|
-
id="confirm-password"
|
|
140
|
-
type="password"
|
|
141
|
-
autocomplete="new-password"
|
|
142
|
-
bind:value={confirmation}
|
|
143
|
-
minlength={12}
|
|
144
|
-
required
|
|
145
|
-
/>
|
|
211
|
+
<div class="cms-settings-actions">
|
|
212
|
+
<Button type="submit" disabled={busy}>Change password</Button>
|
|
146
213
|
</div>
|
|
147
|
-
<Button type="submit" disabled={busy}>Change password</Button>
|
|
148
214
|
</form>
|
|
149
215
|
</Card.Root>
|
|
150
|
-
{#if !data.user?.mustChangePassword}<Card.Root class="cms-detail-card">
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
{enabled
|
|
154
|
-
|
|
155
|
-
:
|
|
156
|
-
</
|
|
157
|
-
{#if
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
216
|
+
{#if !data.user?.mustChangePassword}<Card.Root class="cms-detail-card cms-settings-card">
|
|
217
|
+
<div class="cms-settings-header">
|
|
218
|
+
<h2>Two-factor authentication</h2>
|
|
219
|
+
{#if enabled}<Button variant="outline" size="sm" onclick={() => (disableOpen = true)}
|
|
220
|
+
>Disable</Button
|
|
221
|
+
>{:else}<Badge variant="outline">Off</Badge>{/if}
|
|
222
|
+
</div>
|
|
223
|
+
{#if enabled}
|
|
224
|
+
<div class="cms-empty cms-empty-large cms-protected">
|
|
225
|
+
<ShieldCheck size={36} />
|
|
226
|
+
<h3>Account protected</h3>
|
|
227
|
+
<p>A code from your authenticator app is required at sign-in.</p>
|
|
228
|
+
</div>
|
|
229
|
+
{:else}
|
|
230
|
+
<div class="cms-empty cms-empty-large">
|
|
231
|
+
<ShieldCheck size={36} />
|
|
232
|
+
<h3>Protect your account</h3>
|
|
233
|
+
<p>Require a one-time code from an authenticator app each time you sign in.</p>
|
|
234
|
+
<Button onclick={() => (setupOpen = true)}>Set up two-factor</Button>
|
|
235
|
+
</div>
|
|
236
|
+
{/if}
|
|
237
|
+
</Card.Root>{/if}
|
|
238
|
+
{#if data.user?.role === 'admin' && !data.user.mustChangePassword}<ApiKeys />{/if}
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
<Dialog.Root
|
|
242
|
+
bind:open={setupOpen}
|
|
243
|
+
onOpenChange={(open) => {
|
|
244
|
+
if (!open) resetSetup();
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
<Dialog.Content portalProps={{ disabled: true }}>
|
|
248
|
+
{#if step === 1}
|
|
249
|
+
<Dialog.Header>
|
|
250
|
+
<Dialog.Description>Step 1 of 3</Dialog.Description>
|
|
251
|
+
<Dialog.Title>Confirm your password</Dialog.Title>
|
|
252
|
+
</Dialog.Header>
|
|
253
|
+
<form
|
|
254
|
+
class="cms-setup"
|
|
255
|
+
onsubmit={(e) => {
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
startSetup();
|
|
258
|
+
}}
|
|
259
|
+
>
|
|
260
|
+
<div class="cms-field">
|
|
261
|
+
<Label for="2fa-password">Password</Label>
|
|
262
|
+
<Input
|
|
175
263
|
id="2fa-password"
|
|
176
264
|
type="password"
|
|
177
265
|
autocomplete="current-password"
|
|
178
266
|
bind:value={twoFactorPassword}
|
|
179
267
|
required
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
<
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
</
|
|
268
|
+
/>
|
|
269
|
+
</div>
|
|
270
|
+
{#if dialogError}<Notice error>{dialogError}</Notice>{/if}
|
|
271
|
+
<Dialog.Footer>
|
|
272
|
+
<Button variant="outline" onclick={() => (setupOpen = false)}>Cancel</Button>
|
|
273
|
+
<Button type="submit" disabled={busy}>Continue</Button>
|
|
274
|
+
</Dialog.Footer>
|
|
275
|
+
</form>
|
|
276
|
+
{:else if step === 2}
|
|
277
|
+
<Dialog.Header>
|
|
278
|
+
<Dialog.Description>Step 2 of 3</Dialog.Description>
|
|
279
|
+
<Dialog.Title>Add to your authenticator</Dialog.Title>
|
|
280
|
+
</Dialog.Header>
|
|
281
|
+
<div class="cms-setup">
|
|
282
|
+
<div class="cms-qr">
|
|
283
|
+
{#if qrUrl}<img
|
|
284
|
+
src={qrUrl}
|
|
285
|
+
width="176"
|
|
286
|
+
height="176"
|
|
287
|
+
alt="Scan with your authenticator app"
|
|
288
|
+
/>{/if}
|
|
289
|
+
<p class="cms-muted">Scan this code with your authenticator app.</p>
|
|
290
|
+
</div>
|
|
291
|
+
<div class="cms-setup-key">
|
|
292
|
+
<span class="cms-muted">Setup code</span>
|
|
293
|
+
<div class="cms-secret-row">
|
|
294
|
+
<code class="cms-secret">{secret}</code>
|
|
295
|
+
<Button
|
|
296
|
+
class="cms-copy"
|
|
297
|
+
variant="ghost"
|
|
298
|
+
size="icon-sm"
|
|
299
|
+
aria-label={copied ? 'Setup code copied' : 'Copy setup code'}
|
|
300
|
+
onclick={copySecret}
|
|
301
|
+
>{#if copied}<Check />{:else}<Copy />{/if}</Button
|
|
302
|
+
>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
<form
|
|
306
|
+
class="cms-setup"
|
|
307
|
+
onsubmit={(e) => {
|
|
308
|
+
e.preventDefault();
|
|
309
|
+
verify();
|
|
310
|
+
}}
|
|
311
|
+
>
|
|
312
|
+
<div class="cms-field">
|
|
313
|
+
<Label for="totp">Enter the 6-digit code</Label>
|
|
314
|
+
<InputOTP.Root
|
|
315
|
+
inputId="totp"
|
|
316
|
+
maxlength={6}
|
|
317
|
+
inputmode="numeric"
|
|
318
|
+
autocomplete="one-time-code"
|
|
319
|
+
bind:value={code}
|
|
320
|
+
onComplete={verify}
|
|
321
|
+
>
|
|
322
|
+
{#snippet children({ cells })}
|
|
323
|
+
<InputOTP.Group class="cms-otp">
|
|
324
|
+
{#each cells as cell (cell)}<InputOTP.Slot {cell} />{/each}
|
|
325
|
+
</InputOTP.Group>
|
|
326
|
+
{/snippet}
|
|
327
|
+
</InputOTP.Root>
|
|
328
|
+
</div>
|
|
329
|
+
{#if dialogError}<Notice error>{dialogError}</Notice>{/if}
|
|
330
|
+
<Dialog.Footer>
|
|
331
|
+
<Button variant="outline" onclick={() => (setupOpen = false)}>Cancel</Button>
|
|
332
|
+
<Button type="submit" disabled={busy}>Verify and continue</Button>
|
|
333
|
+
</Dialog.Footer>
|
|
334
|
+
</form>
|
|
335
|
+
</div>
|
|
336
|
+
{:else}
|
|
337
|
+
<Dialog.Header>
|
|
338
|
+
<Dialog.Description>Step 3 of 3</Dialog.Description>
|
|
339
|
+
<Dialog.Title>Save your recovery codes</Dialog.Title>
|
|
340
|
+
</Dialog.Header>
|
|
341
|
+
<div class="cms-recovery">
|
|
342
|
+
<p class="cms-muted">Store these privately. Each code can be used once.</p>
|
|
343
|
+
<ul class="cms-recovery-codes">
|
|
344
|
+
{#each codes as recoveryCode (recoveryCode)}<li><code>{recoveryCode}</code></li>{/each}
|
|
345
|
+
</ul>
|
|
346
|
+
<Dialog.Footer>
|
|
347
|
+
<Button variant="outline" onclick={copyCodes}>Copy</Button>
|
|
348
|
+
<Button variant="outline" onclick={download}>Download</Button>
|
|
349
|
+
<Button onclick={finishSetup}>Done</Button>
|
|
350
|
+
</Dialog.Footer>
|
|
351
|
+
</div>
|
|
352
|
+
{/if}
|
|
353
|
+
</Dialog.Content>
|
|
354
|
+
</Dialog.Root>
|
|
192
355
|
|
|
193
|
-
|
|
356
|
+
<Dialog.Root
|
|
357
|
+
bind:open={disableOpen}
|
|
358
|
+
onOpenChange={(open) => {
|
|
359
|
+
if (!open) {
|
|
360
|
+
twoFactorPassword = '';
|
|
361
|
+
dialogError = '';
|
|
362
|
+
}
|
|
363
|
+
}}
|
|
364
|
+
>
|
|
365
|
+
<Dialog.Content portalProps={{ disabled: true }}>
|
|
366
|
+
<Dialog.Header>
|
|
367
|
+
<Dialog.Title>Disable two-factor authentication</Dialog.Title>
|
|
368
|
+
<Dialog.Description>Confirm your password to turn off codes at sign-in.</Dialog.Description>
|
|
369
|
+
</Dialog.Header>
|
|
370
|
+
<form
|
|
371
|
+
class="cms-setup"
|
|
372
|
+
onsubmit={(e) => {
|
|
373
|
+
e.preventDefault();
|
|
374
|
+
disable();
|
|
375
|
+
}}
|
|
376
|
+
>
|
|
377
|
+
<div class="cms-field">
|
|
378
|
+
<Label for="disable-2fa-password">Password</Label>
|
|
379
|
+
<Input
|
|
380
|
+
id="disable-2fa-password"
|
|
381
|
+
type="password"
|
|
382
|
+
autocomplete="current-password"
|
|
383
|
+
bind:value={twoFactorPassword}
|
|
384
|
+
required
|
|
385
|
+
/>
|
|
386
|
+
</div>
|
|
387
|
+
{#if dialogError}<Notice error>{dialogError}</Notice>{/if}
|
|
388
|
+
<Dialog.Footer>
|
|
389
|
+
<Button variant="outline" onclick={() => (disableOpen = false)}>Cancel</Button>
|
|
390
|
+
<Button type="submit" variant="destructive" disabled={busy}>Disable</Button>
|
|
391
|
+
</Dialog.Footer>
|
|
392
|
+
</form>
|
|
393
|
+
</Dialog.Content>
|
|
394
|
+
</Dialog.Root>
|