@open-commune/web 0.2.12 → 0.2.14
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/app.config.ts +6 -0
- package/assets/css/main.css +119 -0
- package/components/layout/entrance-mark.vue +18 -0
- package/components/layout/navigations/primary/dropdown-publish.vue +6 -4
- package/components/layout/shell/shell-account-menu.vue +55 -0
- package/components/layout/shell/shell-header.vue +99 -0
- package/composables/core/domains/use-auth.ts +108 -0
- package/composables/use-models.js +1 -3
- package/layouts/default.vue +1 -2
- package/layouts/entrance.vue +1 -6
- package/layouts/record.vue +1 -2
- package/middleware/00.light-mode.global.ts +8 -0
- package/nuxt.config.ts +8 -0
- package/package.json +7 -4
- package/pages/index/index.vue +54 -62
- package/pages/index/password/define/[token].vue +44 -68
- package/pages/index/password/recover/index.vue +43 -54
- package/pages/index/welcome/[token].vue +42 -79
- package/pages/index.vue +6 -37
- package/plugins/00.appearance.client.ts +7 -0
- package/utils/location.js +36 -0
- package/components/layout/navigations/primary.vue +0 -132
- package/models/entrance.js +0 -42
- package/public/logo-black.svg +0 -1
- package/public/logo-white.svg +0 -1
package/app.config.ts
CHANGED
package/assets/css/main.css
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
@import "@nuxt/ui";
|
|
3
|
+
@import "@fontsource-variable/inter";
|
|
4
|
+
@import "@fontsource-variable/source-serif-4";
|
|
5
|
+
|
|
6
|
+
/* `plain:` dresses an element under the client look, as `dark:` does under the
|
|
7
|
+
dark mode: the plugin sets `data-appearance` on <html>. */
|
|
8
|
+
@custom-variant plain (&:where([data-appearance='plain'], [data-appearance='plain'] *));
|
|
3
9
|
|
|
4
10
|
/* Legacy text sizes still referenced by pre-refonte screens; drop once every
|
|
5
11
|
screen has moved to Nuxt UI components. */
|
|
@@ -10,4 +16,117 @@
|
|
|
10
16
|
--text-4xs: 0.5rem;
|
|
11
17
|
--text-3xs: 0.625rem;
|
|
12
18
|
--text-2xs: 0.75rem;
|
|
19
|
+
|
|
20
|
+
--font-sans: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
21
|
+
/* The EDITORIAL voice: titles carry it, and only they. Overrides
|
|
22
|
+
Tailwind's own `--font-serif`, so `font-serif` is this face. */
|
|
23
|
+
--font-serif: "Source Serif 4 Variable", Georgia, "Times New Roman", serif;
|
|
24
|
+
|
|
25
|
+
/* A card's elevation: a soft shadow, NOT a rule. */
|
|
26
|
+
--shadow-card: 0 1px 2px rgb(28 25 23 / 0.04), 0 6px 24px rgb(28 25 23 / 0.05);
|
|
27
|
+
|
|
28
|
+
/* Paper and ink, from the frozen prototype. Every design token below is
|
|
29
|
+
assigned from this palette — never from a raw value. */
|
|
30
|
+
--color-paper-50: #ffffff;
|
|
31
|
+
--color-paper-100: #faf9f5;
|
|
32
|
+
--color-paper-200: #f5f3ec;
|
|
33
|
+
--color-paper-300: #f0eee7;
|
|
34
|
+
--color-paper-400: #e7e4dc;
|
|
35
|
+
--color-paper-500: #dbd7cc;
|
|
36
|
+
--color-ink-100: #f0eee7;
|
|
37
|
+
--color-ink-200: #bab6ab;
|
|
38
|
+
--color-ink-300: #8a867c;
|
|
39
|
+
--color-ink-400: #57544c;
|
|
40
|
+
--color-ink-500: #52504a;
|
|
41
|
+
--color-ink-600: #3a362f;
|
|
42
|
+
--color-ink-700: #2e2b25;
|
|
43
|
+
--color-ink-800: #262420;
|
|
44
|
+
--color-ink-900: #1e1c18;
|
|
45
|
+
--color-ink-950: #161512;
|
|
46
|
+
--color-ink: #1b1a17;
|
|
47
|
+
--color-terracotta-400: #d07a57;
|
|
48
|
+
--color-terracotta-600: #c15f3c;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:root {
|
|
52
|
+
--ui-bg: var(--color-paper-100);
|
|
53
|
+
--ui-bg-muted: var(--color-paper-200);
|
|
54
|
+
--ui-bg-elevated: var(--color-paper-50);
|
|
55
|
+
--ui-bg-accented: var(--color-paper-300);
|
|
56
|
+
--ui-bg-inverted: var(--color-ink);
|
|
57
|
+
--ui-text-dimmed: var(--color-ink-200);
|
|
58
|
+
--ui-text-muted: var(--color-ink-300);
|
|
59
|
+
--ui-text-toned: var(--color-ink-500);
|
|
60
|
+
--ui-text: var(--color-ink-500);
|
|
61
|
+
--ui-text-highlighted: var(--color-ink);
|
|
62
|
+
--ui-text-inverted: var(--color-paper-100);
|
|
63
|
+
--ui-border: var(--color-paper-400);
|
|
64
|
+
--ui-border-muted: var(--color-paper-300);
|
|
65
|
+
--ui-border-accented: var(--color-paper-500);
|
|
66
|
+
--ui-border-inverted: var(--color-ink);
|
|
67
|
+
/* The whole Tailwind radius scale derives from this: rounded-md lands on
|
|
68
|
+
10.5px (controls) and rounded-lg on 14px (panels) — the prototype values. */
|
|
69
|
+
--ui-radius: 0.4375rem;
|
|
70
|
+
/* The brand accent IS the secondary colour; states keep Nuxt UI's own. */
|
|
71
|
+
--ui-secondary: var(--color-terracotta-600);
|
|
72
|
+
--ui-success: #3d7a4e;
|
|
73
|
+
--ui-warning: #a8752b;
|
|
74
|
+
--ui-error: #a9412f;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Same e-ink language, warm paper inverted. */
|
|
78
|
+
.dark {
|
|
79
|
+
--ui-bg: var(--color-ink-950);
|
|
80
|
+
--ui-bg-muted: var(--color-ink-900);
|
|
81
|
+
--ui-bg-elevated: var(--color-ink-900);
|
|
82
|
+
--ui-bg-accented: var(--color-ink-800);
|
|
83
|
+
--ui-bg-inverted: var(--color-ink-100);
|
|
84
|
+
--ui-text-dimmed: var(--color-ink-400);
|
|
85
|
+
--ui-text-muted: var(--color-ink-300);
|
|
86
|
+
--ui-text-toned: var(--color-ink-200);
|
|
87
|
+
--ui-text: var(--color-ink-200);
|
|
88
|
+
--ui-text-highlighted: var(--color-ink-100);
|
|
89
|
+
--ui-text-inverted: var(--color-ink-950);
|
|
90
|
+
--ui-border: var(--color-ink-700);
|
|
91
|
+
--ui-border-muted: var(--color-ink-800);
|
|
92
|
+
--ui-border-accented: var(--color-ink-600);
|
|
93
|
+
--ui-border-inverted: var(--color-ink-100);
|
|
94
|
+
--ui-secondary: var(--color-terracotta-400);
|
|
95
|
+
--ui-success: #5b9a6c;
|
|
96
|
+
--ui-warning: #c29048;
|
|
97
|
+
--ui-error: #c56350;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The `plain` appearance: Nuxt UI as it ships — system font, white ground,
|
|
102
|
+
* neutral greys. An instance asks for it through `NUXT_PUBLIC_APPEARANCE`;
|
|
103
|
+
* `plugins/00.appearance.client.ts` writes the attribute. Every token the
|
|
104
|
+
* default appearance sets above is answered here, so the two stay a pair: a
|
|
105
|
+
* token added to one is added to the other. It has no dark variant:
|
|
106
|
+
* `middleware/00.light-mode.global.ts` holds the whole admin to the light mode.
|
|
107
|
+
*/
|
|
108
|
+
:root[data-appearance='plain'] {
|
|
109
|
+
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
110
|
+
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
111
|
+
|
|
112
|
+
--ui-bg: white;
|
|
113
|
+
--ui-bg-muted: var(--ui-color-neutral-50);
|
|
114
|
+
--ui-bg-elevated: var(--ui-color-neutral-100);
|
|
115
|
+
--ui-bg-accented: var(--ui-color-neutral-200);
|
|
116
|
+
--ui-bg-inverted: var(--ui-color-neutral-900);
|
|
117
|
+
--ui-text-dimmed: var(--ui-color-neutral-400);
|
|
118
|
+
--ui-text-muted: var(--ui-color-neutral-500);
|
|
119
|
+
--ui-text-toned: var(--ui-color-neutral-600);
|
|
120
|
+
--ui-text: var(--ui-color-neutral-700);
|
|
121
|
+
--ui-text-highlighted: var(--ui-color-neutral-900);
|
|
122
|
+
--ui-text-inverted: white;
|
|
123
|
+
--ui-border: var(--ui-color-neutral-200);
|
|
124
|
+
--ui-border-muted: var(--ui-color-neutral-200);
|
|
125
|
+
--ui-border-accented: var(--ui-color-neutral-300);
|
|
126
|
+
--ui-border-inverted: var(--ui-color-neutral-900);
|
|
127
|
+
--ui-radius: 0.25rem;
|
|
128
|
+
--ui-secondary: var(--ui-color-secondary-500);
|
|
129
|
+
--ui-success: var(--ui-color-success-500);
|
|
130
|
+
--ui-warning: var(--ui-color-warning-500);
|
|
131
|
+
--ui-error: var(--ui-color-error-500);
|
|
13
132
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="grid size-14 place-items-center rounded-full bg-inverted">
|
|
3
|
+
<UIcon name="i-lucide-landmark" class="size-6 text-inverted" />
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
/**
|
|
9
|
+
* The mark that opens every entrance screen, inside the card and above its
|
|
10
|
+
* title. One component for the four screens, so a layer that has a mark of its
|
|
11
|
+
* own overrides a single file.
|
|
12
|
+
*
|
|
13
|
+
* An ICON and not a brand file on purpose: the product is self-hosted under
|
|
14
|
+
* the name of whoever installs it, and a logo that is not theirs would be
|
|
15
|
+
* wrong. It takes the colour opposite to its disc, which `text-inverted` gives
|
|
16
|
+
* in both themes.
|
|
17
|
+
*/
|
|
18
|
+
</script>
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
<div v-if="record?.deployment?.vercel?.hook" class="relative">
|
|
3
3
|
<button
|
|
4
4
|
id="options-menu"
|
|
5
|
-
class="inline-flex items-center justify-center border border-transparent rounded-md shadow-sm text-sm text-white hover:bg-white dark:hover:bg-gray-950 hover:text-black focus:outline-none hover:border-black disabled:bg-gray-200 disabled:border-gray-300 disabled:text-gray-400"
|
|
5
|
+
class="inline-flex size-9 items-center justify-center border border-transparent rounded-md shadow-sm text-sm text-white hover:bg-white dark:hover:bg-gray-950 hover:text-black focus:outline-none hover:border-black disabled:bg-gray-200 disabled:border-gray-300 disabled:text-gray-400"
|
|
6
6
|
:class="finish ? 'bg-green-400' : 'bg-black'"
|
|
7
|
+
aria-label="Publier le site"
|
|
8
|
+
title="Publier le site"
|
|
7
9
|
aria-haspopup="true"
|
|
8
10
|
aria-expanded="true"
|
|
9
11
|
@click.prevent="_toggle"
|
|
10
12
|
>
|
|
11
|
-
<icon v-if="finish" icon="iconoir:window-check" class="text-white hover:text-primary
|
|
12
|
-
<icon v-else-if="deploying" icon="ei:spinner-2" class="animate-spin
|
|
13
|
+
<icon v-if="finish" icon="iconoir:window-check" class="text-white hover:text-primary size-5" />
|
|
14
|
+
<icon v-else-if="deploying" icon="ei:spinner-2" class="animate-spin size-5" />
|
|
13
15
|
<icon
|
|
14
16
|
v-else
|
|
15
17
|
icon="iconoir:upload-data-window"
|
|
16
|
-
class="text-white hover:text-primary
|
|
18
|
+
class="text-white hover:text-primary size-5"
|
|
17
19
|
/>
|
|
18
20
|
</button>
|
|
19
21
|
<transition
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UPopover v-model:open="open" :content="{ align: 'end' }" :ui="{ content: 'bg-elevated plain:bg-default !rounded-lg' }">
|
|
3
|
+
<!-- A square like the controls beside it, carrying the initials that the
|
|
4
|
+
avatar draws from the name. -->
|
|
5
|
+
<button type="button" class="cursor-pointer rounded-md" aria-label="Mon compte">
|
|
6
|
+
<UAvatar
|
|
7
|
+
:alt="userName"
|
|
8
|
+
:ui="{
|
|
9
|
+
root: 'size-9 rounded-md border border-accented bg-default hover:bg-elevated',
|
|
10
|
+
fallback: 'text-[13px] font-normal uppercase text-toned',
|
|
11
|
+
}"
|
|
12
|
+
/>
|
|
13
|
+
</button>
|
|
14
|
+
|
|
15
|
+
<template #content>
|
|
16
|
+
<div class="w-72">
|
|
17
|
+
<div class="border-b border-muted px-4 py-3.5">
|
|
18
|
+
<p class="truncate text-sm font-medium text-highlighted">{{ userName }}</p>
|
|
19
|
+
<p class="mt-0.5 truncate text-[13px] text-muted">{{ user?.email }}</p>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<button
|
|
23
|
+
type="button"
|
|
24
|
+
class="w-full cursor-pointer px-4 py-2.5 text-left text-[13px] text-error hover:bg-muted"
|
|
25
|
+
@click="_logout"
|
|
26
|
+
>
|
|
27
|
+
Se déconnecter
|
|
28
|
+
</button>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
</UPopover>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
/**
|
|
36
|
+
* What concerns the signed-in person, in one place: who they are and signing
|
|
37
|
+
* out. Help sits beside it in the header. A theme choice joins them when the
|
|
38
|
+
* admin leaves the light mode it is held to (`middleware/00.light-mode.global.ts`).
|
|
39
|
+
* Without a name, the avatar's initial is the email's first letter.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const $session = useSession()
|
|
43
|
+
const $router = useRouter()
|
|
44
|
+
|
|
45
|
+
const open = ref(false)
|
|
46
|
+
|
|
47
|
+
const user = computed(() => $session.user.value)
|
|
48
|
+
const userName = computed(() => user.value?.name || user.value?.email || 'Mon compte')
|
|
49
|
+
|
|
50
|
+
const _logout = async () => {
|
|
51
|
+
open.value = false
|
|
52
|
+
await $session.logout()
|
|
53
|
+
$router.replace('/')
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<header class="border-b border-default bg-elevated plain:bg-default">
|
|
3
|
+
<UContainer class="max-w-7xl">
|
|
4
|
+
<div class="flex items-center justify-between gap-4 py-5">
|
|
5
|
+
<!-- Single tenant: the commune's identity, no selector. -->
|
|
6
|
+
<NuxtLink to="/overview" class="flex min-w-0 items-center gap-3">
|
|
7
|
+
<!-- The logo, or the initials of the commune when it has none. -->
|
|
8
|
+
<avatar-circular
|
|
9
|
+
:place-holder="workspaceStore.workspaceName || 'C'"
|
|
10
|
+
:media="workspaceStore.workspaceLogo"
|
|
11
|
+
size="sm"
|
|
12
|
+
/>
|
|
13
|
+
<span class="truncate font-serif text-[15px] font-semibold text-highlighted plain:font-sans plain:text-base plain:font-medium plain:text-default">
|
|
14
|
+
{{ workspaceStore.workspaceName }}
|
|
15
|
+
</span>
|
|
16
|
+
</NuxtLink>
|
|
17
|
+
|
|
18
|
+
<div class="flex shrink-0 items-center gap-2">
|
|
19
|
+
<dropdown-publish v-if="displayPublishButton" />
|
|
20
|
+
<!-- Help stays in sight, beside the account, whenever the instance
|
|
21
|
+
has an address for it. -->
|
|
22
|
+
<UButton
|
|
23
|
+
v-if="supportUrl"
|
|
24
|
+
:to="supportUrl"
|
|
25
|
+
target="_blank"
|
|
26
|
+
rel="noopener"
|
|
27
|
+
icon="i-lucide-message-circle-question"
|
|
28
|
+
color="neutral"
|
|
29
|
+
variant="outline"
|
|
30
|
+
square
|
|
31
|
+
class="size-9 justify-center"
|
|
32
|
+
aria-label="Demander de l'aide"
|
|
33
|
+
/>
|
|
34
|
+
<layout-shell-account-menu />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</UContainer>
|
|
38
|
+
|
|
39
|
+
<div v-if="navItems.length">
|
|
40
|
+
<UContainer class="max-w-7xl">
|
|
41
|
+
<UNavigationMenu
|
|
42
|
+
:items="navItems"
|
|
43
|
+
color="neutral"
|
|
44
|
+
highlight
|
|
45
|
+
highlight-color="neutral"
|
|
46
|
+
class="hidden sm:flex"
|
|
47
|
+
:ui="{
|
|
48
|
+
// Spaced as the frozen admin had them, in both looks. A commune
|
|
49
|
+
// with many collections scrolls its bar rather than truncating a
|
|
50
|
+
// label. The mark under the current tab is inset by the link's own
|
|
51
|
+
// padding, so it spans the text.
|
|
52
|
+
list: 'overflow-x-auto',
|
|
53
|
+
item: 'shrink-0 mr-6',
|
|
54
|
+
link: 'px-1 py-1.5 after:inset-x-1 text-sm font-medium hover:text-highlighted plain:font-light plain:tracking-wide plain:aria-[current=page]:font-normal',
|
|
55
|
+
}"
|
|
56
|
+
/>
|
|
57
|
+
</UContainer>
|
|
58
|
+
</div>
|
|
59
|
+
</header>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script setup>
|
|
63
|
+
import { useWorkspaceStore } from '~/store/layout/workspace'
|
|
64
|
+
import avatarCircular from '~/components/elements/avatars/avatar-circular'
|
|
65
|
+
import dropdownPublish from '~/components/layout/navigations/primary/dropdown-publish'
|
|
66
|
+
|
|
67
|
+
const { Collection } = useModels()
|
|
68
|
+
const $ability = useAbility()
|
|
69
|
+
const $route = useRoute()
|
|
70
|
+
|
|
71
|
+
const workspaceStore = useWorkspaceStore()
|
|
72
|
+
const { public: { supportUrl } } = useRuntimeConfig()
|
|
73
|
+
|
|
74
|
+
// Single tenant: the Organisations and Roles screens have no object any more
|
|
75
|
+
// (one commune, fixed roles), so they are not in the bar.
|
|
76
|
+
const displayPublishButton = computed(() => !!workspaceStore.workspaceId
|
|
77
|
+
&& ($ability.can('manage:all')
|
|
78
|
+
|| $ability.can('admin:organization')
|
|
79
|
+
|| $ability.can('create:deployments'))
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const navItems = computed(() => {
|
|
83
|
+
if (!workspaceStore.workspaceId) return []
|
|
84
|
+
const collections = Collection.repo.find(workspaceStore.workspaceCollections)
|
|
85
|
+
const items = [
|
|
86
|
+
{ label: 'Accueil', to: '/overview', active: $route.path === '/overview' },
|
|
87
|
+
...collections.map(({ name, slug }) => ({
|
|
88
|
+
label: name,
|
|
89
|
+
to: `/${slug}`,
|
|
90
|
+
active: slug === $route.params.collection,
|
|
91
|
+
})),
|
|
92
|
+
]
|
|
93
|
+
// Settings sit at the far end, for whoever may administer.
|
|
94
|
+
if ($ability.can('admin:organization')) {
|
|
95
|
+
items.push({ label: 'Paramètres', to: '/settings', active: $route.path.startsWith('/settings') })
|
|
96
|
+
}
|
|
97
|
+
return [items]
|
|
98
|
+
})
|
|
99
|
+
</script>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entrance flows that need no session: accepting an invitation, asking for
|
|
3
|
+
* a password reset, defining the new password.
|
|
4
|
+
*
|
|
5
|
+
* A write owns what surrounds it, whole: its `catch`, its `is…` pending flag,
|
|
6
|
+
* the sentence it puts on screen and the redirection that follows — none of
|
|
7
|
+
* which a screen should have to repeat. It answers whether it went through
|
|
8
|
+
* instead of throwing, and the caller has nothing left to do but call it.
|
|
9
|
+
*/
|
|
10
|
+
export default function useAuth() {
|
|
11
|
+
const trpc = useTrpc()
|
|
12
|
+
|
|
13
|
+
// Created per `useAuth()`, so two screens never share a spinner.
|
|
14
|
+
const isAcceptingInvitation = ref(false)
|
|
15
|
+
const isDefiningPassword = ref(false)
|
|
16
|
+
const isRequestingPasswordReset = ref(false)
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* One public step. The account exists once this returns: the sign-in screen
|
|
20
|
+
* is where it is used, so that is where it lands.
|
|
21
|
+
*/
|
|
22
|
+
const acceptInvitation = async (input: { token: string; name: string; password: string }): Promise<boolean> => {
|
|
23
|
+
const toast = useToast()
|
|
24
|
+
isAcceptingInvitation.value = true
|
|
25
|
+
try {
|
|
26
|
+
await trpc.invitations.accept.mutate(input)
|
|
27
|
+
} catch {
|
|
28
|
+
// The password is validated before sending: only the token can be wrong.
|
|
29
|
+
toast.add({
|
|
30
|
+
icon: 'iconoir:password-error',
|
|
31
|
+
color: 'warning',
|
|
32
|
+
title: 'Cette invitation n\'est plus valide.',
|
|
33
|
+
description: 'Demandez-en une nouvelle à un administrateur.',
|
|
34
|
+
})
|
|
35
|
+
return false
|
|
36
|
+
} finally {
|
|
37
|
+
isAcceptingInvitation.value = false
|
|
38
|
+
}
|
|
39
|
+
toast.add({ icon: 'iconoir:password-cursor', color: 'success', title: 'Compte activé, connectez-vous.' })
|
|
40
|
+
await navigateTo('/')
|
|
41
|
+
return true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The answer is the same whether the address exists or not: otherwise the
|
|
46
|
+
* screen becomes a directory of accounts. No redirection — the screen that
|
|
47
|
+
* asked stays, and says the mail is gone.
|
|
48
|
+
*/
|
|
49
|
+
const requestPasswordReset = async (email: string): Promise<boolean> => {
|
|
50
|
+
const toast = useToast()
|
|
51
|
+
isRequestingPasswordReset.value = true
|
|
52
|
+
try {
|
|
53
|
+
await trpc.invitations.requestPasswordReset.mutate({ email })
|
|
54
|
+
toast.add({
|
|
55
|
+
icon: 'iconoir:mail-out',
|
|
56
|
+
color: 'success',
|
|
57
|
+
title: 'Email envoyé.',
|
|
58
|
+
description: `Le lien part vers ${email}.`,
|
|
59
|
+
})
|
|
60
|
+
return true
|
|
61
|
+
} catch {
|
|
62
|
+
toast.add({
|
|
63
|
+
icon: 'iconoir:warning-triangle',
|
|
64
|
+
color: 'warning',
|
|
65
|
+
title: 'La demande n\'a pas pu être envoyée.',
|
|
66
|
+
description: 'Réessayez dans quelques minutes.',
|
|
67
|
+
})
|
|
68
|
+
return false
|
|
69
|
+
} finally {
|
|
70
|
+
isRequestingPasswordReset.value = false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The reset mail's link lands on /password/define/<token>: the same
|
|
76
|
+
* acceptance, without the name — the server already holds it.
|
|
77
|
+
*/
|
|
78
|
+
const definePassword = async (input: { token: string; password: string }): Promise<boolean> => {
|
|
79
|
+
const toast = useToast()
|
|
80
|
+
isDefiningPassword.value = true
|
|
81
|
+
try {
|
|
82
|
+
await trpc.invitations.accept.mutate(input)
|
|
83
|
+
} catch {
|
|
84
|
+
// The length is validated before sending: only the link can be wrong.
|
|
85
|
+
toast.add({
|
|
86
|
+
icon: 'iconoir:password-error',
|
|
87
|
+
color: 'warning',
|
|
88
|
+
title: 'Ce lien a expiré ou a déjà été utilisé.',
|
|
89
|
+
description: 'Demandez-en un nouveau depuis « mot de passe oublié ».',
|
|
90
|
+
})
|
|
91
|
+
return false
|
|
92
|
+
} finally {
|
|
93
|
+
isDefiningPassword.value = false
|
|
94
|
+
}
|
|
95
|
+
toast.add({ icon: 'iconoir:password-cursor', color: 'success', title: 'Mot de passe mis à jour, connectez-vous.' })
|
|
96
|
+
await navigateTo('/')
|
|
97
|
+
return true
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
acceptInvitation,
|
|
102
|
+
isAcceptingInvitation: readonly(isAcceptingInvitation),
|
|
103
|
+
requestPasswordReset,
|
|
104
|
+
isRequestingPasswordReset: readonly(isRequestingPasswordReset),
|
|
105
|
+
definePassword,
|
|
106
|
+
isDefiningPassword: readonly(isDefiningPassword),
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -5,7 +5,6 @@ import Record from '~/models/record'
|
|
|
5
5
|
import Role from '~/models/role'
|
|
6
6
|
import Token from '~/models/token'
|
|
7
7
|
import User from '~/models/user'
|
|
8
|
-
import Entrance from '~/models/entrance'
|
|
9
8
|
|
|
10
9
|
// @review on pourrait pas déplacer le dossier models dans le dossier composables pour ajouter plus de clareté ? Aussi cette factory me semble un peu alambiquée, pourquoi a t on besoin de passer le model + api url dans un objet exporté par le model lui meme
|
|
11
10
|
// bref, je pense que qu'il y a de l'overengineering ici aussi non ?
|
|
@@ -21,7 +20,6 @@ export default () => {
|
|
|
21
20
|
Record: new Record.api(Record.model, apiURL),
|
|
22
21
|
Role: new Role.api(Role.model, apiURL),
|
|
23
22
|
Token: new Token.api(Token.model, apiURL),
|
|
24
|
-
User: new User.api(User.model, apiURL)
|
|
25
|
-
Entrance: new Entrance.api(Entrance.model, apiURL)
|
|
23
|
+
User: new User.api(User.model, apiURL)
|
|
26
24
|
}
|
|
27
25
|
}
|
package/layouts/default.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="min-h-screen">
|
|
3
3
|
<!-- <NuxtLoadingIndicator /> -->
|
|
4
|
-
<
|
|
4
|
+
<layout-shell-header />
|
|
5
5
|
<headings-collection />
|
|
6
6
|
<main class="py-8 max-w-3xl mx-auto px-4 sm:px-6 lg:max-w-7xl lg:px-8 h-full">
|
|
7
7
|
<section>
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script setup>
|
|
17
|
-
import primaryNavigation from '~/components/layout/navigations/primary'
|
|
18
17
|
import headingsCollection from '~/components/layout/headings/headings-collection'
|
|
19
18
|
import formModal from '~/components/forms/layouts/modal'
|
|
20
19
|
import notificationsList from '~/components/layout/notifications/notifications-list'
|
package/layouts/entrance.vue
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="min-w-screen min-h-screen">
|
|
2
|
+
<div class="min-w-screen min-h-screen bg-default text-default">
|
|
3
3
|
<slot />
|
|
4
|
-
<notifications-list />
|
|
5
4
|
</div>
|
|
6
5
|
</template>
|
|
7
|
-
|
|
8
|
-
<script setup>
|
|
9
|
-
import notificationsList from '~/components/layout/notifications/notifications-list'
|
|
10
|
-
</script>
|
package/layouts/record.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="min-h-screen">
|
|
3
3
|
<!-- <NuxtLoadingIndicator /> -->
|
|
4
|
-
<
|
|
4
|
+
<layout-shell-header />
|
|
5
5
|
<headings-record />
|
|
6
6
|
<main class="py-8 max-w-3xl mx-auto px-4 sm:px-6 lg:max-w-7xl lg:px-8 h-full">
|
|
7
7
|
<section>
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script setup>
|
|
17
|
-
import primaryNavigation from '~/components/layout/navigations/primary'
|
|
18
17
|
import headingsRecord from '~/components/layout/headings/headings-record'
|
|
19
18
|
import formModal from '~/components/forms/layouts/modal'
|
|
20
19
|
import notificationsList from '~/components/layout/notifications/notifications-list'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The admin is held to the light mode for now: the screens not yet ported were
|
|
2
|
+
// never drawn for a dark ground (hard-coded greys and whites), and a half-dark
|
|
3
|
+
// admin reads worse than a light one. The colour-mode module reads this meta
|
|
4
|
+
// after each navigation. Dark mode comes back, following the reader's scheme,
|
|
5
|
+
// with the last ported screen.
|
|
6
|
+
export default defineNuxtRouteMiddleware((to) => {
|
|
7
|
+
to.meta.colorMode = 'light'
|
|
8
|
+
})
|
package/nuxt.config.ts
CHANGED
|
@@ -76,6 +76,14 @@ export default defineNuxtConfig({
|
|
|
76
76
|
apiURL: process.env.NUXT_ENV_API_URL ?? '',
|
|
77
77
|
baseURL: process.env.NUXT_ENV_BASE_URL || 'http://localhost:3000',
|
|
78
78
|
mapBoxToken: process.env.NUXT_ENV_MAPBOX_TOKEN,
|
|
79
|
+
// The look of the admin: empty for the default (paper and ink), or
|
|
80
|
+
// `plain` for Nuxt UI as it ships. Read at runtime from
|
|
81
|
+
// NUXT_PUBLIC_APPEARANCE, so one image serves every instance.
|
|
82
|
+
appearance: '',
|
|
83
|
+
// Where someone locked out asks for help. Empty by default: the product
|
|
84
|
+
// is self-hosted, and its installer's support is not ours. Set through
|
|
85
|
+
// NUXT_PUBLIC_SUPPORT_URL, it brings the link up on the sign-in screen.
|
|
86
|
+
supportUrl: '',
|
|
79
87
|
},
|
|
80
88
|
},
|
|
81
89
|
// Le build du site est déclenché chaque nuit à 00:30 (heure LOCALE du
|
package/package.json
CHANGED
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@casl/ability": "^7.0.2",
|
|
17
|
+
"@fontsource-variable/inter": "^5.3.0",
|
|
18
|
+
"@fontsource-variable/source-serif-4": "^5.3.0",
|
|
17
19
|
"@iconify/vue": "^5.0.3",
|
|
18
20
|
"@nuxt/kit": "^4.6.1",
|
|
19
21
|
"@nuxt/ui": "^4.12.0",
|
|
20
|
-
"@open-commune/core": "^0.2.
|
|
21
|
-
"@open-commune/editor": "^0.2.
|
|
22
|
+
"@open-commune/core": "^0.2.14",
|
|
23
|
+
"@open-commune/editor": "^0.2.14",
|
|
22
24
|
"@pinia-orm/nuxt": "^2.0.0",
|
|
23
25
|
"@pinia/nuxt": "^1.0.3",
|
|
24
26
|
"@tanstack/vue-query": "^5.104.3",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
},
|
|
41
43
|
"description": "The Open Commune application: the admin interface and the server, on a single origin.",
|
|
42
44
|
"license": "AGPL-3.0-or-later",
|
|
43
|
-
"version": "0.2.
|
|
45
|
+
"version": "0.2.14",
|
|
44
46
|
"type": "module",
|
|
45
47
|
"main": "./nuxt.config.ts",
|
|
46
48
|
"files": [
|
|
@@ -59,7 +61,8 @@
|
|
|
59
61
|
"plugins",
|
|
60
62
|
"public",
|
|
61
63
|
"server",
|
|
62
|
-
"store"
|
|
64
|
+
"store",
|
|
65
|
+
"utils"
|
|
63
66
|
],
|
|
64
67
|
"publishConfig": {
|
|
65
68
|
"access": "public"
|