or3-provider-basic-auth 0.0.13 → 0.0.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/README.md +177 -0
- package/dist/module.json +1 -1
- package/dist/runtime/assets/signin-hero-dark.webp +0 -0
- package/dist/runtime/assets/signin-hero-light.webp +0 -0
- package/dist/runtime/assets/signup-clouds-bottom-dark.webp +0 -0
- package/dist/runtime/assets/signup-clouds-bottom-light.webp +0 -0
- package/dist/runtime/assets/signup-hero-dark.webp +0 -0
- package/dist/runtime/assets/signup-hero-light.webp +0 -0
- package/dist/runtime/components/BasicAuthChangePasswordModal.client.vue +31 -5
- package/dist/runtime/components/BasicAuthLockPage.client.d.vue.ts +13 -1
- package/dist/runtime/components/BasicAuthLockPage.client.vue +68 -15
- package/dist/runtime/components/BasicAuthLockPage.client.vue.d.ts +13 -1
- package/dist/runtime/components/BasicAuthRegisterModal.client.d.vue.ts +1 -0
- package/dist/runtime/components/BasicAuthRegisterModal.client.vue +91 -31
- package/dist/runtime/components/BasicAuthRegisterModal.client.vue.d.ts +1 -0
- package/dist/runtime/components/BasicAuthSignInModal.client.d.vue.ts +2 -1
- package/dist/runtime/components/BasicAuthSignInModal.client.vue +71 -35
- package/dist/runtime/components/BasicAuthSignInModal.client.vue.d.ts +2 -1
- package/dist/runtime/components/SidebarAuthButtonBasic.client.d.vue.ts +9 -1
- package/dist/runtime/components/SidebarAuthButtonBasic.client.vue +33 -44
- package/dist/runtime/components/SidebarAuthButtonBasic.client.vue.d.ts +9 -1
- package/dist/runtime/lib/constants.d.ts +2 -0
- package/dist/runtime/lib/constants.js +1 -0
- package/dist/runtime/plugins/auth-status.client.js +7 -2
- package/dist/runtime/plugins/basic-auth-ui.client.js +4 -2
- package/dist/runtime/server/api/basic-auth/_helpers.js +1 -1
- package/dist/runtime/server/api/basic-auth/change-password.post.js +2 -2
- package/dist/runtime/server/api/basic-auth/register.post.js +19 -11
- package/dist/runtime/server/api/basic-auth/sign-in.post.js +14 -13
- package/dist/runtime/server/api/basic-auth/sign-out.post.js +2 -1
- package/package.json +2 -2
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UModal
|
|
3
3
|
v-model:open="isOpen"
|
|
4
|
-
title="Create
|
|
5
|
-
description="
|
|
6
|
-
:close="{
|
|
7
|
-
class: 'theme-btn',
|
|
8
|
-
size: 'sm'
|
|
9
|
-
}"
|
|
4
|
+
title="Create your account"
|
|
5
|
+
description="Get started in under a minute."
|
|
10
6
|
:ui="modalUi"
|
|
11
7
|
>
|
|
8
|
+
<template #close>
|
|
9
|
+
<UButton
|
|
10
|
+
icon="i-lucide-x"
|
|
11
|
+
aria-label="Close"
|
|
12
|
+
color="neutral"
|
|
13
|
+
variant="ghost"
|
|
14
|
+
class="basic-auth-register-close"
|
|
15
|
+
:ui="{ base: 'p-0! max-md:p-0!' }"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
18
|
+
<template #title>
|
|
19
|
+
<img :src="logoUrl" alt="" aria-hidden="true" class="basic-auth-register-logo" />
|
|
20
|
+
<span class="basic-auth-register-heading">Create your account</span>
|
|
21
|
+
</template>
|
|
22
|
+
<template #actions>
|
|
23
|
+
<span aria-hidden="true" class="basic-auth-register-hero" />
|
|
24
|
+
</template>
|
|
12
25
|
<template #body>
|
|
13
|
-
<UForm :state="state" @submit.prevent="onSubmit">
|
|
14
|
-
<div class="
|
|
26
|
+
<UForm :state="state" class="basic-auth-register-form" @submit.prevent="onSubmit">
|
|
27
|
+
<div class="basic-auth-register-fields">
|
|
15
28
|
<input
|
|
16
29
|
:value="state.email"
|
|
17
30
|
type="text"
|
|
@@ -26,6 +39,7 @@
|
|
|
26
39
|
<UInput
|
|
27
40
|
v-model="state.email"
|
|
28
41
|
type="email"
|
|
42
|
+
icon="i-lucide-mail"
|
|
29
43
|
placeholder="you@example.com"
|
|
30
44
|
autocomplete="username"
|
|
31
45
|
required
|
|
@@ -37,6 +51,7 @@
|
|
|
37
51
|
<UInput
|
|
38
52
|
v-model="state.displayName"
|
|
39
53
|
type="text"
|
|
54
|
+
icon="i-lucide-user-round"
|
|
40
55
|
placeholder="Your name"
|
|
41
56
|
autocomplete="name"
|
|
42
57
|
class="w-full"
|
|
@@ -46,11 +61,12 @@
|
|
|
46
61
|
<UFormField
|
|
47
62
|
label="Password"
|
|
48
63
|
name="password"
|
|
49
|
-
hint="
|
|
64
|
+
hint="Use at least 8 characters"
|
|
50
65
|
>
|
|
51
66
|
<UInput
|
|
52
67
|
v-model="state.password"
|
|
53
68
|
type="password"
|
|
69
|
+
icon="i-lucide-lock-keyhole"
|
|
54
70
|
placeholder="••••••••"
|
|
55
71
|
autocomplete="new-password"
|
|
56
72
|
minlength="8"
|
|
@@ -64,6 +80,7 @@
|
|
|
64
80
|
<UInput
|
|
65
81
|
v-model="state.confirmPassword"
|
|
66
82
|
type="password"
|
|
83
|
+
icon="i-lucide-lock-keyhole"
|
|
67
84
|
placeholder="••••••••"
|
|
68
85
|
autocomplete="new-password"
|
|
69
86
|
minlength="8"
|
|
@@ -74,39 +91,58 @@
|
|
|
74
91
|
</UFormField>
|
|
75
92
|
|
|
76
93
|
<UFormField
|
|
77
|
-
:label="
|
|
94
|
+
:label="inviteLabel"
|
|
78
95
|
name="inviteToken"
|
|
79
96
|
>
|
|
80
97
|
<UInput
|
|
81
98
|
v-model="state.inviteToken"
|
|
82
99
|
type="text"
|
|
83
|
-
|
|
100
|
+
icon="i-lucide-ticket"
|
|
101
|
+
placeholder="Paste invite code"
|
|
84
102
|
class="w-full"
|
|
85
103
|
/>
|
|
86
104
|
</UFormField>
|
|
87
105
|
|
|
88
106
|
<div
|
|
89
107
|
v-if="errorMessage"
|
|
108
|
+
role="alert"
|
|
90
109
|
class="flex items-start gap-2 rounded-[var(--md-border-radius)] border border-[var(--md-error)]/30 bg-[var(--md-error)]/8 px-3 py-2.5 text-sm text-[var(--md-error)]"
|
|
91
110
|
>
|
|
92
111
|
<UIcon name="i-lucide-alert-circle" class="w-4 h-4 mt-0.5 shrink-0" />
|
|
93
112
|
{{ errorMessage }}
|
|
94
113
|
</div>
|
|
95
114
|
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
<div class="basic-auth-register-footer">
|
|
116
|
+
<p class="basic-auth-register-existing">
|
|
117
|
+
Already registered?
|
|
118
|
+
<button
|
|
119
|
+
type="button"
|
|
120
|
+
:disabled="pending"
|
|
121
|
+
@click="emit('open-sign-in', state.inviteToken)"
|
|
122
|
+
>Sign in</button>
|
|
123
|
+
</p>
|
|
124
|
+
<div class="basic-auth-register-actions">
|
|
125
|
+
<UButton
|
|
126
|
+
color="neutral"
|
|
127
|
+
variant="outline"
|
|
128
|
+
type="button"
|
|
129
|
+
class="basic-auth-register-cancel"
|
|
130
|
+
:disabled="pending"
|
|
131
|
+
@click="close"
|
|
132
|
+
>
|
|
133
|
+
Cancel
|
|
134
|
+
</UButton>
|
|
135
|
+
<UButton
|
|
136
|
+
color="neutral"
|
|
137
|
+
class="basic-auth-register-submit"
|
|
138
|
+
type="submit"
|
|
139
|
+
trailing-icon="i-lucide-arrow-right"
|
|
140
|
+
:loading="pending"
|
|
141
|
+
:ui="{ label: 'tracking-normal', trailingIcon: 'size-5' }"
|
|
142
|
+
>
|
|
143
|
+
Create account
|
|
144
|
+
</UButton>
|
|
145
|
+
</div>
|
|
110
146
|
</div>
|
|
111
147
|
</div>
|
|
112
148
|
</UForm>
|
|
@@ -116,14 +152,28 @@
|
|
|
116
152
|
|
|
117
153
|
<script setup>
|
|
118
154
|
import { computed, reactive, ref, watch } from "vue";
|
|
155
|
+
import { useRuntimeConfig } from "#imports";
|
|
119
156
|
import { newPasswordFitsBcrypt } from "../password-policy";
|
|
120
157
|
const modalUi = {
|
|
121
|
-
overlay: "basic-auth-modal-overlay",
|
|
122
|
-
content: "basic-auth-modal-content
|
|
158
|
+
overlay: "basic-auth-modal-overlay basic-auth-register-overlay",
|
|
159
|
+
content: "basic-auth-modal-content basic-auth-register-content",
|
|
160
|
+
header: "basic-auth-register-header",
|
|
161
|
+
wrapper: "basic-auth-register-intro",
|
|
162
|
+
title: "basic-auth-register-title",
|
|
163
|
+
description: "basic-auth-register-description",
|
|
164
|
+
body: "basic-auth-register-body"
|
|
123
165
|
};
|
|
166
|
+
const runtimeConfig = useRuntimeConfig();
|
|
167
|
+
const inviteRequired = computed(() => runtimeConfig.public?.registrationMode === "invite_only");
|
|
168
|
+
const logoUrl = computed(() => runtimeConfig.public?.branding?.logoUrl || "/logos/logo-svg.svg");
|
|
124
169
|
const props = defineProps({
|
|
125
170
|
modelValue: { type: Boolean, required: true },
|
|
126
|
-
inviteToken: { type: [String, null], required: false }
|
|
171
|
+
inviteToken: { type: [String, null], required: false },
|
|
172
|
+
initialEmail: { type: String, required: false }
|
|
173
|
+
});
|
|
174
|
+
const inviteLabel = computed(() => {
|
|
175
|
+
if (props.inviteToken) return "Invite code (from your invite link)";
|
|
176
|
+
return inviteRequired.value ? "Invite code (required)" : "Invite code (optional)";
|
|
127
177
|
});
|
|
128
178
|
const emit = defineEmits(["update:modelValue", "registered", "open-sign-in"]);
|
|
129
179
|
const state = reactive({
|
|
@@ -135,6 +185,9 @@ const state = reactive({
|
|
|
135
185
|
});
|
|
136
186
|
const pending = ref(false);
|
|
137
187
|
const errorMessage = ref("");
|
|
188
|
+
watch(() => props.modelValue, (open) => {
|
|
189
|
+
if (open && props.initialEmail) state.email = props.initialEmail.trim();
|
|
190
|
+
}, { immediate: true });
|
|
138
191
|
const isOpen = computed({
|
|
139
192
|
get: () => props.modelValue,
|
|
140
193
|
set: (value) => {
|
|
@@ -157,14 +210,17 @@ function validateClientSide() {
|
|
|
157
210
|
return "Password must be at least 8 characters.";
|
|
158
211
|
}
|
|
159
212
|
if (state.password.length > 512) {
|
|
160
|
-
return "Password is too long.";
|
|
213
|
+
return "Password is too long. Please shorten it.";
|
|
161
214
|
}
|
|
162
215
|
if (!newPasswordFitsBcrypt(state.password)) {
|
|
163
|
-
return "Password
|
|
216
|
+
return "Password is too long. Please shorten it.";
|
|
164
217
|
}
|
|
165
218
|
if (state.password !== state.confirmPassword) {
|
|
166
219
|
return "Passwords must match.";
|
|
167
220
|
}
|
|
221
|
+
if (inviteRequired.value && !state.inviteToken.trim()) {
|
|
222
|
+
return "Enter an invite code to create an account. Use the link or code from your invitation.";
|
|
223
|
+
}
|
|
168
224
|
return null;
|
|
169
225
|
}
|
|
170
226
|
function readFetchErrorMessage(error) {
|
|
@@ -198,7 +254,7 @@ async function onSubmit() {
|
|
|
198
254
|
const statusCode = typeof error === "object" && error !== null && "statusCode" in error ? Number(error.statusCode) : null;
|
|
199
255
|
const serverMessage = readFetchErrorMessage(error);
|
|
200
256
|
if (statusCode === 400) {
|
|
201
|
-
errorMessage.value = serverMessage || "Please check your email and password
|
|
257
|
+
errorMessage.value = serverMessage || "Please check your email and password, then try again.";
|
|
202
258
|
} else if (statusCode === 403) {
|
|
203
259
|
errorMessage.value = serverMessage || "Registration is restricted for this instance.";
|
|
204
260
|
} else if (statusCode === 401) {
|
|
@@ -213,3 +269,7 @@ async function onSubmit() {
|
|
|
213
269
|
}
|
|
214
270
|
}
|
|
215
271
|
</script>
|
|
272
|
+
|
|
273
|
+
<style>
|
|
274
|
+
.basic-auth-register-overlay{backdrop-filter:blur(7px);background:color-mix(in srgb,var(--md-on-surface) 22%,transparent);z-index:100!important}.basic-auth-register-content{--register-sky:#d5eafb;--register-accent:#086db8;--register-field-bg:var(--md-surface);--register-field-border:var(--md-outline-variant,var(--md-border-color));background:radial-gradient(ellipse 60% 36% at 100% 0,var(--register-sky),transparent),var(--md-surface);border:1px solid color-mix(in srgb,var(--md-outline-variant,var(--md-border-color)) 45%,transparent);border-radius:1.75rem;box-shadow:0 40px 100px -32px rgba(24,69,92,.42),0 2px 6px rgb(24 69 92/6%);color:var(--md-on-surface);gap:0;isolation:isolate;max-height:calc(100dvh - 2rem);max-width:44rem;overflow-x:hidden;overflow-y:auto;width:calc(100vw - 2rem);z-index:100!important}.dark .basic-auth-register-content{--register-sky:#1b3352;--register-accent:#7cc0f5;--register-field-bg:color-mix(in srgb,#10213a 30%,var(--md-surface));--register-field-border:color-mix(in srgb,var(--md-on-surface) 16%,transparent);background:radial-gradient(ellipse 60% 36% at 100% 0,var(--register-sky),transparent),linear-gradient(180deg,color-mix(in srgb,#10213a 50%,var(--md-surface)),color-mix(in srgb,#10213a 22%,var(--md-surface)) 55%,color-mix(in srgb,#10213a 40%,var(--md-surface)));border-color:color-mix(in srgb,var(--md-on-surface) 10%,transparent);box-shadow:0 40px 100px -32px rgba(0,0,0,.7),inset 0 1px 0 hsla(0,0%,100%,.06)}.basic-auth-register-content .basic-auth-register-header{background:transparent;border:0;display:block;flex-shrink:0;min-height:0;padding:3rem 4rem 2.25rem;position:relative}.basic-auth-register-intro{position:relative;z-index:1}.basic-auth-register-content .basic-auth-register-title{color:var(--md-on-surface)}.basic-auth-register-logo{display:block;height:2.25rem;margin-bottom:2.25rem;max-width:13rem;-o-object-fit:contain;object-fit:contain;-o-object-position:left;object-position:left;width:auto}.basic-auth-register-heading{display:block;font-size:clamp(2rem,5vw,2.5rem);font-weight:700;letter-spacing:-.035em;line-height:1.1}.basic-auth-register-content .basic-auth-register-description{color:var(--md-on-surface-variant);display:block;font-size:1.125rem;line-height:1.45;margin-top:.5rem}.basic-auth-register-hero{aspect-ratio:760/630;background:url(../assets/signup-hero-light.webp) 100% 0/100% auto no-repeat;-webkit-mask-image:linear-gradient(#000 73%,rgba(0,0,0,.45) 82%,rgba(0,0,0,.12) 90%,transparent 97%);mask-image:linear-gradient(#000 73%,rgba(0,0,0,.45) 82%,rgba(0,0,0,.12) 90%,transparent 97%);pointer-events:none;position:absolute;right:0;top:.625rem;width:min(22rem,50%);z-index:-1}.dark .basic-auth-register-hero{background-image:url(../assets/signup-hero-dark.webp)}.basic-auth-register-content .basic-auth-register-close{align-items:center;background:color-mix(in srgb,var(--md-surface) 92%,transparent);border:1px solid color-mix(in srgb,var(--md-outline-variant,var(--md-border-color)) 35%,transparent);border-radius:50%;box-shadow:0 4px 14px rgba(24,69,92,.12);color:var(--md-on-surface);display:flex;height:2.75rem;inset-inline-end:1.5rem;justify-content:center;min-height:2.75rem;position:absolute;top:1.5rem;width:2.75rem;z-index:2}.dark .basic-auth-register-content .basic-auth-register-close{background:color-mix(in srgb,var(--md-surface) 70%,transparent);border-color:color-mix(in srgb,var(--md-on-surface) 14%,transparent);box-shadow:0 4px 14px rgba(0,0,0,.35)}.basic-auth-register-content .basic-auth-register-body{border:0;flex:none;overflow:visible;padding:0 4rem 2.75rem;position:relative}.basic-auth-register-content .basic-auth-register-body:before{background:url(../assets/signup-clouds-bottom-light.webp) center bottom -4rem/100% auto no-repeat;content:"";inset:0;pointer-events:none;position:absolute;z-index:-1}.dark .basic-auth-register-content .basic-auth-register-body:before{background-image:url(../assets/signup-clouds-bottom-dark.webp)}.basic-auth-register-fields{display:flex;flex-direction:column;gap:1.5rem}.basic-auth-register-form label{color:var(--md-on-surface);font-size:1rem;font-weight:500;margin-bottom:.25rem;padding-inline:0}.basic-auth-register-form input:not([readonly]){background:var(--register-field-bg);border:1px solid var(--register-field-border);border-radius:.75rem;color:var(--md-on-surface);font-size:1rem;height:3.125rem;transition:border-color .15s ease,box-shadow .15s ease}.basic-auth-register-form input:not([readonly]):hover{border-color:color-mix(in srgb,var(--md-on-surface) 32%,transparent)}.basic-auth-register-form input:not([readonly]):focus{border-color:var(--register-accent)}.basic-auth-register-form input::-moz-placeholder{color:color-mix(in srgb,var(--md-on-surface-variant) 78%,var(--md-surface));opacity:1}.basic-auth-register-form input::placeholder{color:color-mix(in srgb,var(--md-on-surface-variant) 78%,var(--md-surface));opacity:1}.basic-auth-register-form [data-slot=leading]{padding-inline-start:1.125rem}.basic-auth-register-form [data-slot=leadingIcon]{color:var(--md-on-surface-variant)}@layer components{.basic-auth-register-form input:not([readonly]){padding-inline:3.25rem 1rem!important}.basic-auth-register-form input:not([readonly]):focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--register-accent) 18%,transparent)!important}.basic-auth-register-content .basic-auth-register-actions>button{padding-inline:1.375rem!important}}.basic-auth-register-footer{align-items:center;display:flex;flex-wrap:wrap;gap:1rem;justify-content:space-between;padding-top:1.5rem;position:relative}.basic-auth-register-footer:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2384c341' stroke-linecap='round' stroke-width='2.4' viewBox='0 0 24 24'%3E%3Cpath d='m12.4 16.6-6.6-2.4m9.2-.9-4-5.8m8 4.5V5'/%3E%3C/svg%3E") 50% /contain no-repeat;content:"";height:1.375rem;left:-2.25rem;pointer-events:none;position:absolute;top:.375rem;width:1.375rem}.basic-auth-register-existing{color:var(--md-on-surface-variant);font-size:1rem;margin:0}.dark .basic-auth-register-existing{text-shadow:0 0 12px rgba(9,18,33,.9),0 1px 2px rgba(9,18,33,.8)}.basic-auth-register-existing button{color:var(--register-accent);cursor:pointer;font-weight:500;min-height:2.75rem;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:4px}.basic-auth-register-actions{display:flex;gap:.75rem;margin-left:auto}.basic-auth-register-content .basic-auth-register-actions>button{border-radius:.75rem;font-size:1rem;font-weight:500;height:3.125rem;justify-content:center;letter-spacing:normal;min-height:3.125rem}.basic-auth-register-content .basic-auth-register-cancel{background:var(--register-field-bg);border:1px solid var(--register-field-border);box-shadow:none;color:var(--md-on-surface)}.basic-auth-register-content .basic-auth-register-cancel:hover{background:color-mix(in srgb,var(--md-on-surface) 5%,var(--md-surface))}.basic-auth-register-content .basic-auth-register-submit{background:var(--md-on-surface);border:1px solid transparent;box-shadow:0 6px 16px -6px rgba(0,0,0,.35);color:var(--md-surface);gap:.75rem}.basic-auth-register-content .basic-auth-register-submit:hover{background:color-mix(in srgb,var(--md-on-surface) 88%,var(--md-surface))}.basic-auth-register-content button:focus-visible{outline:2px solid var(--register-accent);outline-offset:3px}.basic-auth-register-content button:disabled{cursor:default;opacity:.6}@media (width >= 640px) and (height < 58rem){.basic-auth-register-content .basic-auth-register-header{padding-bottom:1.5rem;padding-top:2.25rem}.basic-auth-register-logo{height:2rem;margin-bottom:1.5rem}.basic-auth-register-heading{font-size:2.25rem}.basic-auth-register-content .basic-auth-register-body{padding-bottom:2rem}.basic-auth-register-fields{gap:1rem}.basic-auth-register-content .basic-auth-register-actions>button,.basic-auth-register-form input:not([readonly]){height:2.875rem;min-height:2.875rem}.basic-auth-register-footer{padding-top:1rem}}@media (width < 640px){.basic-auth-register-content{border-radius:1.25rem;max-height:calc(100dvh - 1rem);width:calc(100vw - 1rem)}.basic-auth-register-content .basic-auth-register-header{padding:1.75rem 1.5rem 1.5rem}.basic-auth-register-logo{height:1.75rem;margin-bottom:4.75rem;max-width:10rem}.basic-auth-register-heading{font-size:1.875rem}.basic-auth-register-content .basic-auth-register-description{font-size:1rem}.basic-auth-register-hero{top:.75rem;width:12.5rem}.basic-auth-register-content .basic-auth-register-close{inset-inline-end:.75rem;top:.75rem}.basic-auth-register-content .basic-auth-register-body{padding:0 1.5rem 1.75rem}.basic-auth-register-content .basic-auth-register-body:before{background-position:bottom}.basic-auth-register-fields{gap:1rem}.basic-auth-register-content .basic-auth-register-actions>button,.basic-auth-register-form input:not([readonly]){height:3rem;min-height:3rem}.basic-auth-register-footer{gap:.5rem;padding-top:.25rem}.basic-auth-register-footer:before{display:none}.basic-auth-register-actions{width:100%}.basic-auth-register-submit{flex:1}}
|
|
275
|
+
</style>
|
|
@@ -2,6 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
modelValue: boolean;
|
|
3
3
|
/** Token from an invite link; filled in when the form opens. */
|
|
4
4
|
inviteToken?: string | null;
|
|
5
|
+
initialEmail?: string;
|
|
5
6
|
};
|
|
6
7
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
8
|
"update:modelValue": (value: boolean) => any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
modelValue: boolean;
|
|
3
|
-
inviteToken?: string;
|
|
3
|
+
inviteToken?: string | null;
|
|
4
|
+
initialEmail?: string;
|
|
4
5
|
};
|
|
5
6
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
7
|
"update:modelValue": (value: boolean) => any;
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UModal
|
|
3
3
|
v-model:open="isOpen"
|
|
4
|
-
title="
|
|
5
|
-
|
|
6
|
-
class: 'theme-btn',
|
|
7
|
-
size: 'sm'
|
|
8
|
-
}"
|
|
9
|
-
description="Enter your credentials to continue"
|
|
4
|
+
title="Welcome back"
|
|
5
|
+
description="Pick up where you left off."
|
|
10
6
|
:ui="modalUi"
|
|
11
7
|
>
|
|
8
|
+
<template #close>
|
|
9
|
+
<UButton
|
|
10
|
+
icon="i-lucide-x"
|
|
11
|
+
aria-label="Close"
|
|
12
|
+
color="neutral"
|
|
13
|
+
variant="ghost"
|
|
14
|
+
class="basic-auth-sign-in-close"
|
|
15
|
+
:ui="{ base: 'p-0! max-md:p-0!' }"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
18
|
+
<template #title>
|
|
19
|
+
<img :src="logoUrl" alt="" aria-hidden="true" class="basic-auth-sign-in-logo" />
|
|
20
|
+
<span class="basic-auth-sign-in-heading">Welcome back</span>
|
|
21
|
+
</template>
|
|
22
|
+
<template #actions>
|
|
23
|
+
<span aria-hidden="true" class="basic-auth-sign-in-hero" />
|
|
24
|
+
</template>
|
|
12
25
|
<template #body>
|
|
13
|
-
<UForm :state="state" @submit.prevent="onSubmit">
|
|
14
|
-
<div class="
|
|
26
|
+
<UForm :state="state" class="basic-auth-sign-in-form" @submit.prevent="onSubmit">
|
|
27
|
+
<div class="basic-auth-sign-in-fields">
|
|
15
28
|
<input
|
|
16
29
|
:value="state.email"
|
|
17
30
|
type="text"
|
|
@@ -26,6 +39,7 @@
|
|
|
26
39
|
<UInput
|
|
27
40
|
v-model="state.email"
|
|
28
41
|
type="email"
|
|
42
|
+
icon="i-lucide-mail"
|
|
29
43
|
placeholder="you@example.com"
|
|
30
44
|
autocomplete="username"
|
|
31
45
|
required
|
|
@@ -37,6 +51,7 @@
|
|
|
37
51
|
<UInput
|
|
38
52
|
v-model="state.password"
|
|
39
53
|
type="password"
|
|
54
|
+
icon="i-lucide-lock-keyhole"
|
|
40
55
|
placeholder="••••••••"
|
|
41
56
|
autocomplete="current-password"
|
|
42
57
|
required
|
|
@@ -46,35 +61,40 @@
|
|
|
46
61
|
|
|
47
62
|
<div
|
|
48
63
|
v-if="errorMessage"
|
|
64
|
+
role="alert"
|
|
49
65
|
class="flex items-start gap-2 rounded-[var(--md-border-radius)] border border-[var(--md-error)]/30 bg-[var(--md-error)]/8 px-3 py-2.5 text-sm text-[var(--md-error)]"
|
|
50
66
|
>
|
|
51
67
|
<UIcon name="i-lucide-alert-circle" class="w-4 h-4 mt-0.5 shrink-0" />
|
|
52
68
|
{{ errorMessage }}
|
|
53
69
|
</div>
|
|
54
70
|
|
|
55
|
-
<div class="
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
<div class="basic-auth-sign-in-footer">
|
|
72
|
+
<p class="basic-auth-sign-in-register">
|
|
73
|
+
Don’t have an account?
|
|
74
|
+
<button type="button" :disabled="pending" @click="emit('open-register')">Create account</button>
|
|
75
|
+
</p>
|
|
76
|
+
<div class="basic-auth-sign-in-actions">
|
|
77
|
+
<UButton
|
|
78
|
+
color="neutral"
|
|
79
|
+
variant="outline"
|
|
80
|
+
type="button"
|
|
81
|
+
class="basic-auth-sign-in-cancel"
|
|
82
|
+
:disabled="pending"
|
|
83
|
+
@click="close"
|
|
84
|
+
>
|
|
85
|
+
Cancel
|
|
86
|
+
</UButton>
|
|
87
|
+
<UButton
|
|
88
|
+
type="submit"
|
|
89
|
+
color="neutral"
|
|
90
|
+
class="basic-auth-sign-in-submit"
|
|
91
|
+
trailing-icon="i-lucide-arrow-right"
|
|
92
|
+
:loading="pending"
|
|
93
|
+
:ui="{ label: 'tracking-normal', trailingIcon: 'size-5' }"
|
|
94
|
+
>
|
|
95
|
+
Sign in
|
|
96
|
+
</UButton>
|
|
97
|
+
</div>
|
|
78
98
|
</div>
|
|
79
99
|
</div>
|
|
80
100
|
</UForm>
|
|
@@ -83,14 +103,23 @@
|
|
|
83
103
|
</template>
|
|
84
104
|
|
|
85
105
|
<script setup>
|
|
86
|
-
import { computed, reactive, ref } from "vue";
|
|
106
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
107
|
+
import { useRuntimeConfig } from "#imports";
|
|
87
108
|
const modalUi = {
|
|
88
|
-
overlay: "basic-auth-modal-overlay",
|
|
89
|
-
content: "basic-auth-modal-content
|
|
109
|
+
overlay: "basic-auth-modal-overlay basic-auth-sign-in-overlay",
|
|
110
|
+
content: "basic-auth-modal-content basic-auth-sign-in-content",
|
|
111
|
+
header: "basic-auth-sign-in-header",
|
|
112
|
+
wrapper: "basic-auth-sign-in-intro",
|
|
113
|
+
title: "basic-auth-sign-in-title",
|
|
114
|
+
description: "basic-auth-sign-in-description",
|
|
115
|
+
body: "basic-auth-sign-in-body"
|
|
90
116
|
};
|
|
117
|
+
const runtimeConfig = useRuntimeConfig();
|
|
118
|
+
const logoUrl = computed(() => runtimeConfig.public?.branding?.logoUrl || "/logos/logo-svg.svg");
|
|
91
119
|
const props = defineProps({
|
|
92
120
|
modelValue: { type: Boolean, required: true },
|
|
93
|
-
inviteToken: { type: String, required: false }
|
|
121
|
+
inviteToken: { type: [String, null], required: false },
|
|
122
|
+
initialEmail: { type: String, required: false }
|
|
94
123
|
});
|
|
95
124
|
const emit = defineEmits(["update:modelValue", "signed-in", "open-register"]);
|
|
96
125
|
const state = reactive({
|
|
@@ -99,6 +128,9 @@ const state = reactive({
|
|
|
99
128
|
});
|
|
100
129
|
const pending = ref(false);
|
|
101
130
|
const errorMessage = ref("");
|
|
131
|
+
watch(() => props.modelValue, (open) => {
|
|
132
|
+
if (open && props.initialEmail) state.email = props.initialEmail.trim();
|
|
133
|
+
}, { immediate: true });
|
|
102
134
|
const isOpen = computed({
|
|
103
135
|
get: () => props.modelValue,
|
|
104
136
|
set: (value) => {
|
|
@@ -137,3 +169,7 @@ async function onSubmit() {
|
|
|
137
169
|
}
|
|
138
170
|
}
|
|
139
171
|
</script>
|
|
172
|
+
|
|
173
|
+
<style>
|
|
174
|
+
.basic-auth-sign-in-overlay{backdrop-filter:blur(7px);background:color-mix(in srgb,var(--md-on-surface) 22%,transparent);z-index:100!important}.basic-auth-sign-in-content{--sign-in-accent:#086db8;--sign-in-sky:#c6eaff;--sign-in-field-bg:var(--md-surface);--sign-in-field-border:var(--md-outline-variant,var(--md-border-color));background:radial-gradient(ellipse 65% 52% at 100% 0,var(--sign-in-sky),transparent),var(--md-surface);border:1px solid color-mix(in srgb,var(--md-outline-variant,var(--md-border-color)) 45%,transparent);border-radius:1.75rem;box-shadow:0 40px 100px -32px rgba(24,69,92,.42),0 2px 6px rgb(24 69 92/6%);color:var(--md-on-surface);gap:0;isolation:isolate;max-height:calc(100dvh - 2rem);max-width:44rem;overflow-x:hidden;overflow-y:auto;width:calc(100vw - 2rem);z-index:100!important}.dark .basic-auth-sign-in-content{--sign-in-accent:#7cc0f5;--sign-in-sky:#233f63;--sign-in-field-bg:color-mix(in srgb,#10213a 30%,var(--md-surface));--sign-in-field-border:color-mix(in srgb,var(--md-on-surface) 18%,transparent);background:radial-gradient(ellipse 65% 52% at 100% 0,var(--sign-in-sky),transparent),color-mix(in srgb,#10213a 40%,var(--md-surface));border-color:color-mix(in srgb,var(--md-on-surface) 12%,transparent);box-shadow:0 40px 100px -32px rgba(0,0,0,.7)}.basic-auth-sign-in-content .basic-auth-sign-in-header{background:transparent;border:0;display:block;flex-shrink:0;min-height:0;padding:3rem 4rem 2.25rem;position:relative}.basic-auth-sign-in-intro{position:relative;z-index:1}.basic-auth-sign-in-content .basic-auth-sign-in-title{color:var(--md-on-surface)}.basic-auth-sign-in-logo{display:block;height:2.25rem;margin-bottom:2.25rem;max-width:13rem;-o-object-fit:contain;object-fit:contain;-o-object-position:left;object-position:left;width:auto}.basic-auth-sign-in-heading{display:block;font-size:clamp(2rem,5vw,2.5rem);font-weight:700;letter-spacing:-.035em;line-height:1.1}.basic-auth-sign-in-content .basic-auth-sign-in-description{color:var(--md-on-surface-variant);display:block;font-size:1.125rem;line-height:1.45;margin-top:.5rem}.basic-auth-sign-in-hero{aspect-ratio:3/2;background:url(../assets/signin-hero-light.webp) 100% 0/100% auto no-repeat;-webkit-mask-image:linear-gradient(#000 80%,rgba(0,0,0,.4) 89%,transparent 98%);mask-image:linear-gradient(#000 80%,rgba(0,0,0,.4) 89%,transparent 98%);pointer-events:none;position:absolute;right:0;top:.625rem;width:62%;z-index:-1}.dark .basic-auth-sign-in-hero{background-image:url(../assets/signin-hero-dark.webp)}.basic-auth-sign-in-content .basic-auth-sign-in-close{align-items:center;background:color-mix(in srgb,var(--md-surface) 94%,transparent);border:1px solid color-mix(in srgb,var(--md-outline-variant,var(--md-border-color)) 30%,transparent);border-radius:50%;box-shadow:0 4px 14px rgba(24,69,92,.1);color:var(--md-on-surface);display:flex;height:2.75rem;inset-inline-end:1.5rem;justify-content:center;min-height:2.75rem;position:absolute;top:1.5rem;width:2.75rem;z-index:2}.basic-auth-sign-in-content .basic-auth-sign-in-body{background:transparent;border:0;flex:none;overflow:visible;padding:0 4rem 2.75rem;position:relative}.basic-auth-sign-in-body:before{background:url(../assets/signup-clouds-bottom-light.webp) center bottom -3.5rem/100% auto no-repeat;content:"";inset:0;pointer-events:none;position:absolute;z-index:-1}.dark .basic-auth-sign-in-body:before{background-image:url(../assets/signup-clouds-bottom-dark.webp);opacity:.7}.basic-auth-sign-in-fields{display:flex;flex-direction:column;gap:1.5rem}.basic-auth-sign-in-form label{color:var(--md-on-surface);font-size:1rem;font-weight:500;margin-bottom:.25rem;padding-inline:0}.basic-auth-sign-in-form input:not([readonly]){background:var(--sign-in-field-bg);border:1px solid var(--sign-in-field-border);border-radius:.75rem;color:var(--md-on-surface);font-size:1rem;height:3.125rem;transition:border-color .15s ease,box-shadow .15s ease}.basic-auth-sign-in-form input:not([readonly]):hover{border-color:color-mix(in srgb,var(--md-on-surface) 32%,transparent)}.basic-auth-sign-in-form input:not([readonly]):focus{border-color:var(--sign-in-accent)}.basic-auth-sign-in-form input::-moz-placeholder{color:var(--md-on-surface-variant);opacity:.75}.basic-auth-sign-in-form input::placeholder{color:var(--md-on-surface-variant);opacity:.75}.basic-auth-sign-in-form [data-slot=leading]{padding-inline-start:1.125rem}.basic-auth-sign-in-form [data-slot=leadingIcon]{color:var(--md-on-surface-variant)}@layer components{.basic-auth-sign-in-form input:not([readonly]){padding-inline:3.25rem 1rem!important}.basic-auth-sign-in-form input:not([readonly]):focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--sign-in-accent) 18%,transparent)!important}.basic-auth-sign-in-content .basic-auth-sign-in-actions>button{padding-inline:1.375rem!important}}.basic-auth-sign-in-footer{align-items:center;display:flex;flex-wrap:wrap;gap:1rem;justify-content:space-between;padding-top:1.5rem}.basic-auth-sign-in-register{color:var(--md-on-surface-variant);font-size:1rem;margin:0}.basic-auth-sign-in-register button{color:var(--sign-in-accent);cursor:pointer;font-weight:500;margin-inline-start:.25rem;min-height:2.75rem;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:4px}.basic-auth-sign-in-actions{display:flex;gap:.75rem;margin-left:auto}.basic-auth-sign-in-content .basic-auth-sign-in-actions>button{border-radius:.75rem;font-size:1rem;font-weight:500;height:3.125rem;justify-content:center;letter-spacing:normal;min-height:3.125rem}.basic-auth-sign-in-content .basic-auth-sign-in-cancel{background:var(--sign-in-field-bg);border:1px solid var(--sign-in-field-border);box-shadow:none;color:var(--md-on-surface)}.basic-auth-sign-in-content .basic-auth-sign-in-submit{background:var(--md-on-surface);border:1px solid transparent;box-shadow:0 7px 18px -6px rgba(0,0,0,.35);color:var(--md-surface);gap:.75rem}.basic-auth-sign-in-content .basic-auth-sign-in-actions>button:hover{filter:brightness(.92)}.basic-auth-sign-in-content button:focus-visible{outline:2px solid var(--sign-in-accent);outline-offset:3px}.basic-auth-sign-in-content button:disabled{cursor:default;opacity:.6}@media (width >= 640px) and (height < 58rem){.basic-auth-sign-in-content .basic-auth-sign-in-header{padding-bottom:1.5rem;padding-top:2.25rem}.basic-auth-sign-in-logo{height:2rem;margin-bottom:1.5rem}.basic-auth-sign-in-heading{font-size:2.25rem}.basic-auth-sign-in-hero{top:0;width:56%}.basic-auth-sign-in-content .basic-auth-sign-in-body{padding-bottom:2rem}.basic-auth-sign-in-fields{gap:1rem}.basic-auth-sign-in-content .basic-auth-sign-in-actions>button,.basic-auth-sign-in-form input:not([readonly]){height:2.875rem;min-height:2.875rem}.basic-auth-sign-in-footer{padding-top:1rem}}@media (width < 640px){.basic-auth-sign-in-content{border-radius:1.25rem;max-height:calc(100dvh - 1rem);width:calc(100vw - 1rem)}.basic-auth-sign-in-content .basic-auth-sign-in-header{padding:1.75rem 1.5rem 1.5rem}.basic-auth-sign-in-logo{height:1.75rem;margin-bottom:6.25rem;max-width:10rem}.basic-auth-sign-in-heading{font-size:1.875rem}.basic-auth-sign-in-content .basic-auth-sign-in-description{font-size:1rem}.basic-auth-sign-in-hero{top:.75rem;width:15rem}.basic-auth-sign-in-content .basic-auth-sign-in-close{inset-inline-end:.75rem;top:.75rem}.basic-auth-sign-in-content .basic-auth-sign-in-body{padding:0 1.5rem 1.75rem}.basic-auth-sign-in-body:before{background-position:bottom}.basic-auth-sign-in-fields{gap:1rem}.basic-auth-sign-in-content .basic-auth-sign-in-actions>button,.basic-auth-sign-in-form input:not([readonly]){height:3rem;min-height:3rem}.basic-auth-sign-in-footer{gap:.5rem;padding-top:.25rem}.basic-auth-sign-in-actions{width:100%}.basic-auth-sign-in-submit{flex:1}}
|
|
175
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
modelValue: boolean;
|
|
3
|
-
inviteToken?: string;
|
|
3
|
+
inviteToken?: string | null;
|
|
4
|
+
initialEmail?: string;
|
|
4
5
|
};
|
|
5
6
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
7
|
"update:modelValue": (value: boolean) => any;
|
|
@@ -2,6 +2,14 @@ import { type AuthUiLayout } from '../lib/auth-ui-layout.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
/** Explicit host layout — preferred over inject (cross-package inject can miss). */
|
|
4
4
|
layout?: AuthUiLayout;
|
|
5
|
+
modalOnly?: boolean;
|
|
6
|
+
open?: boolean;
|
|
5
7
|
};
|
|
6
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
close: () => any;
|
|
10
|
+
"after:leave": () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onClose?: (() => any) | undefined;
|
|
13
|
+
"onAfter:leave"?: (() => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
15
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<template v-if="isBasicAuthProvider">
|
|
3
3
|
<BasicAuthUserMenu
|
|
4
|
-
v-if="isSignedIn"
|
|
4
|
+
v-if="!modalOnly && isSignedIn"
|
|
5
5
|
:email="sessionUser?.email"
|
|
6
6
|
:display-name="sessionUser?.displayName"
|
|
7
7
|
:layout="resolvedLayout"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/>
|
|
11
11
|
|
|
12
12
|
<button
|
|
13
|
-
v-else-if="isMoreSheetLayout"
|
|
13
|
+
v-else-if="!modalOnly && isMoreSheetLayout"
|
|
14
14
|
type="button"
|
|
15
15
|
class="more-row"
|
|
16
16
|
aria-label="Login"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</button>
|
|
32
32
|
|
|
33
33
|
<UButton
|
|
34
|
-
v-else
|
|
34
|
+
v-else-if="!modalOnly"
|
|
35
35
|
v-bind="loginButtonProps"
|
|
36
36
|
type="button"
|
|
37
37
|
aria-label="Login"
|
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
:invite-token="inviteToken"
|
|
55
55
|
@signed-in="onSignedIn"
|
|
56
56
|
@open-register="openRegisterFromSignIn"
|
|
57
|
+
@update:model-value="onDialogOpenChanged"
|
|
58
|
+
@after:leave="onDialogAfterLeave"
|
|
57
59
|
/>
|
|
58
60
|
|
|
59
61
|
<BasicAuthRegisterModal
|
|
@@ -61,6 +63,8 @@
|
|
|
61
63
|
:invite-token="inviteToken"
|
|
62
64
|
@open-sign-in="openSignInFromRegister"
|
|
63
65
|
@registered="onRegistered"
|
|
66
|
+
@update:model-value="onDialogOpenChanged"
|
|
67
|
+
@after:leave="onDialogAfterLeave"
|
|
64
68
|
/>
|
|
65
69
|
|
|
66
70
|
<BasicAuthChangePasswordModal
|
|
@@ -72,54 +76,43 @@
|
|
|
72
76
|
</template>
|
|
73
77
|
|
|
74
78
|
<script setup>
|
|
75
|
-
import { computed, inject, nextTick, onMounted, ref, unref } from "vue";
|
|
79
|
+
import { computed, inject, nextTick, onMounted, ref, unref, watch } from "vue";
|
|
76
80
|
import { useRuntimeConfig } from "#imports";
|
|
81
|
+
import { useSessionContext } from "~/composables/auth/useSessionContext";
|
|
77
82
|
import { BASIC_AUTH_PROVIDER_ID } from "../lib/constants";
|
|
78
83
|
import {
|
|
79
84
|
AUTH_UI_LAYOUT_KEY
|
|
80
85
|
} from "../lib/auth-ui-layout";
|
|
81
|
-
import { silentRefreshOnce } from "../lib/silent-refresh.client";
|
|
82
86
|
import { claimInviteLinkAutoOpen, readInviteLinkToken } from "../lib/invite-link.client";
|
|
83
87
|
import BasicAuthSignInModal from "./BasicAuthSignInModal.client.vue";
|
|
84
88
|
import BasicAuthRegisterModal from "./BasicAuthRegisterModal.client.vue";
|
|
85
89
|
import BasicAuthUserMenu from "./BasicAuthUserMenu.client.vue";
|
|
86
90
|
import BasicAuthChangePasswordModal from "./BasicAuthChangePasswordModal.client.vue";
|
|
87
91
|
const props = defineProps({
|
|
88
|
-
layout: { type: String, required: false }
|
|
92
|
+
layout: { type: String, required: false },
|
|
93
|
+
modalOnly: { type: Boolean, required: false },
|
|
94
|
+
open: { type: Boolean, required: false }
|
|
89
95
|
});
|
|
96
|
+
const emit = defineEmits(["close", "after:leave"]);
|
|
90
97
|
const runtimeConfig = useRuntimeConfig();
|
|
91
|
-
const signInModalOpen = ref(
|
|
98
|
+
const signInModalOpen = ref(props.modalOnly === true && props.open === true);
|
|
92
99
|
const registerModalOpen = ref(false);
|
|
93
100
|
const changePasswordModalOpen = ref(false);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
watch(() => props.open, (open) => {
|
|
102
|
+
if (!props.modalOnly) return;
|
|
103
|
+
signInModalOpen.value = open === true;
|
|
104
|
+
if (!open) registerModalOpen.value = false;
|
|
105
|
+
});
|
|
106
|
+
function onDialogOpenChanged(open) {
|
|
107
|
+
if (props.modalOnly && !open) emit("close");
|
|
99
108
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
const payload = await fetchSessionPayload();
|
|
104
|
-
session.value = payload.session ?? null;
|
|
105
|
-
} catch {
|
|
106
|
-
session.value = null;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (session.value || !allowSilentRefresh) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const didRefresh = await silentRefreshOnce();
|
|
113
|
-
if (!didRefresh) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
const payload = await fetchSessionPayload();
|
|
118
|
-
session.value = payload.session ?? null;
|
|
119
|
-
} catch {
|
|
120
|
-
session.value = null;
|
|
121
|
-
}
|
|
109
|
+
function onDialogAfterLeave() {
|
|
110
|
+
if (props.modalOnly && !signInModalOpen.value && !registerModalOpen.value) emit("after:leave");
|
|
122
111
|
}
|
|
112
|
+
const sessionContext = useSessionContext();
|
|
113
|
+
const session = computed(
|
|
114
|
+
() => sessionContext.data.value?.session ?? null
|
|
115
|
+
);
|
|
123
116
|
const isBasicAuthProvider = computed(() => {
|
|
124
117
|
const publicProvider = runtimeConfig.public?.authProvider;
|
|
125
118
|
if (!publicProvider) return true;
|
|
@@ -152,16 +145,13 @@ function notifyAuthSessionChanged() {
|
|
|
152
145
|
if (typeof window === "undefined") return;
|
|
153
146
|
window.dispatchEvent(new CustomEvent("or3:auth-session-changed"));
|
|
154
147
|
}
|
|
155
|
-
|
|
156
|
-
await refreshSession({ allowSilentRefresh: false });
|
|
148
|
+
function onSignedIn() {
|
|
157
149
|
notifyAuthSessionChanged();
|
|
158
150
|
}
|
|
159
|
-
|
|
160
|
-
await refreshSession({ allowSilentRefresh: false });
|
|
151
|
+
function onSignedOut() {
|
|
161
152
|
notifyAuthSessionChanged();
|
|
162
153
|
}
|
|
163
|
-
|
|
164
|
-
await refreshSession({ allowSilentRefresh: false });
|
|
154
|
+
function onPasswordUpdated() {
|
|
165
155
|
notifyAuthSessionChanged();
|
|
166
156
|
}
|
|
167
157
|
async function openRegisterFromSignIn() {
|
|
@@ -171,14 +161,13 @@ async function openRegisterFromSignIn() {
|
|
|
171
161
|
registerModalOpen.value = true;
|
|
172
162
|
}, 0);
|
|
173
163
|
}
|
|
174
|
-
|
|
175
|
-
await refreshSession({ allowSilentRefresh: false });
|
|
164
|
+
function onRegistered() {
|
|
176
165
|
notifyAuthSessionChanged();
|
|
177
166
|
}
|
|
178
167
|
const inviteToken = ref(null);
|
|
179
|
-
onMounted(
|
|
168
|
+
onMounted(() => {
|
|
180
169
|
inviteToken.value = readInviteLinkToken();
|
|
181
|
-
|
|
170
|
+
if (props.modalOnly) return;
|
|
182
171
|
if (!isSignedIn.value && isBasicAuthProvider.value && claimInviteLinkAutoOpen()) {
|
|
183
172
|
registerModalOpen.value = true;
|
|
184
173
|
}
|
|
@@ -2,6 +2,14 @@ import { type AuthUiLayout } from '../lib/auth-ui-layout.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
/** Explicit host layout — preferred over inject (cross-package inject can miss). */
|
|
4
4
|
layout?: AuthUiLayout;
|
|
5
|
+
modalOnly?: boolean;
|
|
6
|
+
open?: boolean;
|
|
5
7
|
};
|
|
6
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
close: () => any;
|
|
10
|
+
"after:leave": () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onClose?: (() => any) | undefined;
|
|
13
|
+
"onAfter:leave"?: (() => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
15
|
export default _default;
|
|
@@ -17,3 +17,5 @@ export declare const LEGACY_REFRESH_COOKIE_PATH = "/api/basic-auth";
|
|
|
17
17
|
* instead of being treated as replay attacks (common under HMR remounts).
|
|
18
18
|
*/
|
|
19
19
|
export declare const REFRESH_ROTATION_GRACE_MS = 30000;
|
|
20
|
+
/** One-shot sessionStorage flag: a password change signs the user out and reloads, so the sign-in screen shows the notice. */
|
|
21
|
+
export declare const PASSWORD_UPDATED_NOTICE_KEY = "or3:basic-auth-password-updated";
|