@jskit-ai/agent-docs 0.1.352 → 0.1.354
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/guide/agent/app-extras/assistant.md +70 -0
- package/guide/agent/app-setup/authentication.md +151 -2
- package/guide/agent/app-setup/database-layer.md +9 -0
- package/guide/agent/app-setup/service-keys.md +103 -0
- package/guide/agent/app-setup/upgrading-jskit.md +11 -2
- package/guide/agent/framework/data-access.md +13 -0
- package/guide/agent/framework/typed-features.md +10 -5
- package/guide/agent/index.md +2 -0
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/example/package.json +3 -3
- package/patterns/shell-foundation/example/package.json +4 -4
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/reference/autogen/PATTERN_INDEX.md +49 -38
- package/reference/autogen/packages/assistant-core.md +44 -8
- package/reference/autogen/packages/assistant-runtime.md +25 -0
- package/reference/autogen/packages/auth-core.md +4 -0
- package/reference/autogen/packages/auth-provider-local-core.md +13 -0
- package/reference/autogen/packages/auth-web.md +60 -16
- package/reference/autogen/packages/crud-core.md +3 -1
- package/reference/autogen/packages/database-runtime.md +1 -0
- package/reference/autogen/packages/http-web.md +1 -0
- package/reference/autogen/packages/realtime.md +2 -1
- package/reference/autogen/packages/resource-runtime.md +9 -0
- package/reference/autogen/packages/shell-web.md +35 -0
- package/reference/autogen/tooling/jskit-catalog.md +13 -6
- package/reference/autogen/tooling/jskit-release.md +12 -5
- package/reference/autogen/tooling/testUtils.md +1 -0
- package/skills/jskit/references/data-access.md +13 -0
- package/skills/jskit/references/database-layer.md +9 -0
- package/skills/jskit/references/heuristics/row-policies.md +1 -1
- package/skills/jskit/references/heuristics/ui-testing.md +3 -3
- package/skills/jskit/references/pattern-index.md +49 -38
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +3 -0
- package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/own-design-sign-in/PATTERN.md +141 -0
- package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/components/ConfirmItsYouDialog.vue +182 -0
- package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/theme/tokens.css +35 -0
- package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/views/auth/LoginView.vue +473 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +1 -1
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +5 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
- package/skills/jskit/references/typed-features.md +10 -5
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, ref, useId, watch } from "vue";
|
|
3
|
+
import { useJskitText } from "@jskit-ai/kernel/client";
|
|
4
|
+
import { useSecondFactorProof } from "@jskit-ai/auth-web/client/composables/useSecondFactorProof";
|
|
5
|
+
import { verifySecondFactor } from "@jskit-ai/auth-web/client/runtime/secondFactorRequests";
|
|
6
|
+
|
|
7
|
+
// The step-up prompt in the app's own design: a native <dialog>, whose page behind it is inert while it is open and
|
|
8
|
+
// whose Escape cancels, over the form useSecondFactorProof() runs, the one JSKIT's SecondFactorDialog renders in
|
|
9
|
+
// Material 3. Bind `open`, `verified` and `cancel` to useSecondFactorStepUp()'s. A refused code shows beside the field.
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
open: { type: Boolean, required: true }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["verified", "cancel"]);
|
|
14
|
+
const { t } = useJskitText();
|
|
15
|
+
const id = useId();
|
|
16
|
+
const dialog = ref(null);
|
|
17
|
+
const field = ref(null);
|
|
18
|
+
const { usingRecoveryCode, code, recoveryCode, fieldError, canSubmit, toggleRecoveryCode, submitProof } = useSecondFactorProof({
|
|
19
|
+
submit: verifySecondFactor,
|
|
20
|
+
onDone: (result) => emit("verified", result)
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
watch(() => props.open, (open) => {
|
|
24
|
+
if (open) {
|
|
25
|
+
dialog.value?.showModal();
|
|
26
|
+
} else {
|
|
27
|
+
dialog.value?.close();
|
|
28
|
+
}
|
|
29
|
+
}, { flush: "post" });
|
|
30
|
+
|
|
31
|
+
async function switchCodeKind() {
|
|
32
|
+
toggleRecoveryCode();
|
|
33
|
+
await nextTick();
|
|
34
|
+
field.value?.focus();
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<!-- Escape asks the page to cancel; the dialog closes when `open` turns false, so the page decides. -->
|
|
40
|
+
<dialog ref="dialog" class="confirm-dialog" :aria-labelledby="`${id}-title`" @cancel.prevent="emit('cancel')">
|
|
41
|
+
<form class="confirm-dialog__form" novalidate @submit.prevent="submitProof">
|
|
42
|
+
<h2 :id="`${id}-title`" class="confirm-dialog__title">{{ t("jskit.auth.secondFactor.prompt.title") }}</h2>
|
|
43
|
+
<p class="confirm-dialog__muted">{{ t("jskit.auth.secondFactor.prompt.explain") }}</p>
|
|
44
|
+
<label :for="`${id}-code`">
|
|
45
|
+
{{ usingRecoveryCode ? t("jskit.auth.secondFactor.form.recoveryCode") : t("jskit.auth.secondFactor.form.code") }}
|
|
46
|
+
</label>
|
|
47
|
+
<input
|
|
48
|
+
v-if="usingRecoveryCode"
|
|
49
|
+
:id="`${id}-code`"
|
|
50
|
+
key="recovery-code"
|
|
51
|
+
ref="field"
|
|
52
|
+
v-model="recoveryCode"
|
|
53
|
+
autocomplete="off"
|
|
54
|
+
autocapitalize="off"
|
|
55
|
+
spellcheck="false"
|
|
56
|
+
:aria-invalid="Boolean(fieldError)"
|
|
57
|
+
:aria-describedby="`${id}-error`"
|
|
58
|
+
autofocus
|
|
59
|
+
>
|
|
60
|
+
<input
|
|
61
|
+
v-else
|
|
62
|
+
:id="`${id}-code`"
|
|
63
|
+
key="code"
|
|
64
|
+
ref="field"
|
|
65
|
+
v-model="code"
|
|
66
|
+
inputmode="numeric"
|
|
67
|
+
autocomplete="one-time-code"
|
|
68
|
+
:aria-invalid="Boolean(fieldError)"
|
|
69
|
+
:aria-describedby="`${id}-error`"
|
|
70
|
+
autofocus
|
|
71
|
+
>
|
|
72
|
+
<p :id="`${id}-error`" class="confirm-dialog__error">{{ fieldError }}</p>
|
|
73
|
+
<button class="confirm-dialog__link" type="button" @click="switchCodeKind">
|
|
74
|
+
{{ usingRecoveryCode ? t("jskit.auth.secondFactor.form.useCode") : t("jskit.auth.secondFactor.form.useRecoveryCode") }}
|
|
75
|
+
</button>
|
|
76
|
+
<div class="confirm-dialog__actions">
|
|
77
|
+
<button class="confirm-dialog__button" type="button" @click="emit('cancel')">{{ t("jskit.auth.secondFactor.cancel") }}</button>
|
|
78
|
+
<button class="confirm-dialog__button confirm-dialog__button--primary" type="submit" :disabled="!canSubmit">
|
|
79
|
+
{{ t("jskit.auth.secondFactor.confirm") }}
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
</form>
|
|
83
|
+
</dialog>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<style scoped>
|
|
87
|
+
.confirm-dialog {
|
|
88
|
+
width: min(400px, calc(100vw - 32px));
|
|
89
|
+
padding: 24px;
|
|
90
|
+
border: 0;
|
|
91
|
+
border-radius: var(--ds-radius-large);
|
|
92
|
+
background: var(--ds-panel);
|
|
93
|
+
color: var(--ds-text);
|
|
94
|
+
font-family: var(--ds-font);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.confirm-dialog::backdrop {
|
|
98
|
+
background: var(--ds-scrim);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.confirm-dialog__form {
|
|
102
|
+
display: grid;
|
|
103
|
+
gap: 8px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.confirm-dialog__title {
|
|
107
|
+
margin: 0;
|
|
108
|
+
font-size: 1.25rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.confirm-dialog__muted,
|
|
112
|
+
.confirm-dialog__error {
|
|
113
|
+
margin: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.confirm-dialog__muted {
|
|
117
|
+
color: var(--ds-text-muted);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.confirm-dialog__form label {
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.confirm-dialog__form input {
|
|
125
|
+
padding: 10px 12px;
|
|
126
|
+
border: 1px solid var(--ds-line);
|
|
127
|
+
border-radius: var(--ds-radius);
|
|
128
|
+
background: var(--ds-panel);
|
|
129
|
+
color: inherit;
|
|
130
|
+
font: inherit;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.confirm-dialog__form input[aria-invalid="true"] {
|
|
134
|
+
border-color: var(--ds-danger);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.confirm-dialog__error {
|
|
138
|
+
min-height: 1.25em;
|
|
139
|
+
color: var(--ds-danger);
|
|
140
|
+
font-size: 0.875rem;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.confirm-dialog__link {
|
|
144
|
+
justify-self: start;
|
|
145
|
+
padding: 4px 0;
|
|
146
|
+
border: 0;
|
|
147
|
+
background: none;
|
|
148
|
+
color: var(--ds-accent);
|
|
149
|
+
font: inherit;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.confirm-dialog__actions {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-wrap: wrap;
|
|
156
|
+
gap: 8px;
|
|
157
|
+
justify-content: flex-end;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.confirm-dialog__button {
|
|
161
|
+
min-height: 44px;
|
|
162
|
+
padding: 10px 16px;
|
|
163
|
+
border: 1px solid var(--ds-line);
|
|
164
|
+
border-radius: var(--ds-radius);
|
|
165
|
+
background: var(--ds-panel);
|
|
166
|
+
color: inherit;
|
|
167
|
+
font: inherit;
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.confirm-dialog__button--primary {
|
|
173
|
+
border-color: var(--ds-accent);
|
|
174
|
+
background: var(--ds-accent);
|
|
175
|
+
color: var(--ds-on-accent);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.confirm-dialog__button:disabled {
|
|
179
|
+
opacity: 0.5;
|
|
180
|
+
cursor: default;
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The app's own design tokens, imported once by its entry (src/main.js). Its screens, the sign-in screen among them,
|
|
3
|
+
* read these names and never a colour of their own. src/theme/ is where an app keeps its colour values; the light
|
|
4
|
+
* values apply by default and the dark ones when the person's system asks for dark.
|
|
5
|
+
*/
|
|
6
|
+
:root {
|
|
7
|
+
--ds-font: "Inter", system-ui, sans-serif;
|
|
8
|
+
--ds-radius: 8px;
|
|
9
|
+
--ds-radius-large: 16px;
|
|
10
|
+
--ds-page: #f4f1ea;
|
|
11
|
+
--ds-panel: #fffdf8;
|
|
12
|
+
--ds-text: #1f1b16;
|
|
13
|
+
--ds-text-muted: #5c544a;
|
|
14
|
+
--ds-line: #cbc2b5;
|
|
15
|
+
--ds-accent: #a4380f;
|
|
16
|
+
--ds-on-accent: #ffffff;
|
|
17
|
+
--ds-danger: #a1121f;
|
|
18
|
+
--ds-danger-soft: #fde7e7;
|
|
19
|
+
--ds-scrim: #1f1b1699;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (prefers-color-scheme: dark) {
|
|
23
|
+
:root {
|
|
24
|
+
--ds-page: #17140f;
|
|
25
|
+
--ds-panel: #221e18;
|
|
26
|
+
--ds-text: #eee7dc;
|
|
27
|
+
--ds-text-muted: #c1b8ab;
|
|
28
|
+
--ds-line: #554d42;
|
|
29
|
+
--ds-accent: #ffb59a;
|
|
30
|
+
--ds-on-accent: #5a1a00;
|
|
31
|
+
--ds-danger: #ffb4ab;
|
|
32
|
+
--ds-danger-soft: #3d1210;
|
|
33
|
+
--ds-scrim: #000000b3;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useId } from "vue";
|
|
3
|
+
import { useJskitText } from "@jskit-ai/kernel/client";
|
|
4
|
+
import { useLoginView } from "@jskit-ai/auth-web/client/composables/useLoginView";
|
|
5
|
+
import AppBrand from "@/components/AppBrand.vue";
|
|
6
|
+
|
|
7
|
+
// The app's sign-in screen in its own design system: plain HTML and the app's CSS (the tokens of src/theme/), no
|
|
8
|
+
// Vuetify. Every behavior comes from useLoginView(), the composable JSKIT's DefaultLoginView renders in Material 3:
|
|
9
|
+
// the modes, the provider buttons, the remembered account, invitations, the returnTo landing and the session checks.
|
|
10
|
+
// The words are JSKIT's messages, so the app's translations apply.
|
|
11
|
+
const { t } = useJskitText();
|
|
12
|
+
const id = useId();
|
|
13
|
+
const {
|
|
14
|
+
authTitle,
|
|
15
|
+
authSubtitle,
|
|
16
|
+
isLogin,
|
|
17
|
+
isRegister,
|
|
18
|
+
isForgot,
|
|
19
|
+
isOtp,
|
|
20
|
+
isEmailConfirmationPending,
|
|
21
|
+
redirectingSignedIn,
|
|
22
|
+
canUsePasswordLogin,
|
|
23
|
+
canRegister,
|
|
24
|
+
canRequestPasswordRecovery,
|
|
25
|
+
canUseOtp,
|
|
26
|
+
canUseOAuth,
|
|
27
|
+
canResendEmailConfirmation,
|
|
28
|
+
canEnterConfirmationCode,
|
|
29
|
+
needsFirstAccountSetupCode,
|
|
30
|
+
setupCode,
|
|
31
|
+
confirmationUrl,
|
|
32
|
+
confirmationCode,
|
|
33
|
+
confirmationLinkToken,
|
|
34
|
+
registrationConfirmPending,
|
|
35
|
+
confirmRegistrationFromLink,
|
|
36
|
+
emailConfirmationMessage,
|
|
37
|
+
showRememberedAccount,
|
|
38
|
+
switchMode,
|
|
39
|
+
goToMainScreen,
|
|
40
|
+
rememberedAccountDisplayName,
|
|
41
|
+
rememberedAccountMaskedEmail,
|
|
42
|
+
rememberedAccountSwitchLabel,
|
|
43
|
+
switchAccount,
|
|
44
|
+
email,
|
|
45
|
+
emailErrorMessages,
|
|
46
|
+
emailTouched,
|
|
47
|
+
password,
|
|
48
|
+
passwordErrorMessages,
|
|
49
|
+
passwordTouched,
|
|
50
|
+
confirmPassword,
|
|
51
|
+
confirmPasswordErrorMessages,
|
|
52
|
+
confirmPasswordTouched,
|
|
53
|
+
otpCode,
|
|
54
|
+
otpCodeErrorMessages,
|
|
55
|
+
otpCodeTouched,
|
|
56
|
+
rememberAccountOnDevice,
|
|
57
|
+
otpRequestPending,
|
|
58
|
+
registerConfirmationResendPending,
|
|
59
|
+
requestOtpCode,
|
|
60
|
+
resendRegisterConfirmationEmail,
|
|
61
|
+
oauthProviders,
|
|
62
|
+
startOAuthSignIn,
|
|
63
|
+
oauthProviderButtonLabel,
|
|
64
|
+
oauthRetryProvider,
|
|
65
|
+
signInPausedMinutes,
|
|
66
|
+
errorMessage,
|
|
67
|
+
infoMessage,
|
|
68
|
+
loading,
|
|
69
|
+
canSubmit,
|
|
70
|
+
submitLabel,
|
|
71
|
+
submitAuth
|
|
72
|
+
} = useLoginView();
|
|
73
|
+
|
|
74
|
+
function providerName(providerId) {
|
|
75
|
+
return oauthProviders.value.find((provider) => provider.id === providerId)?.label || providerId;
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<main class="auth-page">
|
|
81
|
+
<!-- A browser already signed in is on its way to the page it asked for: it is shown no form. -->
|
|
82
|
+
<section v-if="!redirectingSignedIn" class="auth-panel" :aria-labelledby="`${id}-title`">
|
|
83
|
+
<AppBrand />
|
|
84
|
+
<h1 :id="`${id}-title`" class="auth-title">{{ authTitle }}</h1>
|
|
85
|
+
<p v-if="authSubtitle" class="auth-muted">{{ authSubtitle }}</p>
|
|
86
|
+
|
|
87
|
+
<div
|
|
88
|
+
v-if="canRegister && (isLogin || isRegister) && !showRememberedAccount"
|
|
89
|
+
class="auth-tabs"
|
|
90
|
+
role="radiogroup"
|
|
91
|
+
:aria-label="t('jskit.auth.login.mode.label')"
|
|
92
|
+
>
|
|
93
|
+
<button type="button" role="radio" :aria-checked="String(isLogin)" @click="switchMode('login')">
|
|
94
|
+
{{ t("jskit.auth.login.mode.signIn") }}
|
|
95
|
+
</button>
|
|
96
|
+
<button type="button" role="radio" :aria-checked="String(isRegister)" @click="switchMode('register')">
|
|
97
|
+
{{ t("jskit.auth.login.mode.register") }}
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<!-- The refusal stays beside the form until the next attempt; the shell's banner hears it too. -->
|
|
102
|
+
<p v-if="errorMessage" class="auth-message auth-message--error" role="alert">{{ errorMessage }}</p>
|
|
103
|
+
<p v-else-if="infoMessage" class="auth-message" role="status">{{ infoMessage }}</p>
|
|
104
|
+
|
|
105
|
+
<form class="auth-form" novalidate @submit.prevent="submitAuth">
|
|
106
|
+
<template v-if="isEmailConfirmationPending">
|
|
107
|
+
<p class="auth-note">{{ emailConfirmationMessage }}</p>
|
|
108
|
+
<div class="auth-field">
|
|
109
|
+
<label :for="`${id}-registration-password`">{{ t("jskit.auth.login.field.registrationPassword") }}</label>
|
|
110
|
+
<input
|
|
111
|
+
:id="`${id}-registration-password`"
|
|
112
|
+
v-model="password"
|
|
113
|
+
type="password"
|
|
114
|
+
autocomplete="current-password"
|
|
115
|
+
:aria-invalid="passwordErrorMessages.length > 0"
|
|
116
|
+
:aria-describedby="`${id}-registration-password-hint`"
|
|
117
|
+
@blur="passwordTouched = true"
|
|
118
|
+
>
|
|
119
|
+
<p :id="`${id}-registration-password-hint`" class="auth-field__line">
|
|
120
|
+
{{ passwordErrorMessages[0] || t("jskit.auth.login.confirmEmail.passwordHint") }}
|
|
121
|
+
</p>
|
|
122
|
+
</div>
|
|
123
|
+
<div v-if="canEnterConfirmationCode && !confirmationLinkToken" class="auth-field">
|
|
124
|
+
<label :for="`${id}-confirmation-code`">{{ t("jskit.auth.login.field.confirmationCode") }}</label>
|
|
125
|
+
<input :id="`${id}-confirmation-code`" v-model="confirmationCode" autocomplete="off">
|
|
126
|
+
</div>
|
|
127
|
+
<button
|
|
128
|
+
v-if="confirmationLinkToken || canEnterConfirmationCode"
|
|
129
|
+
class="auth-button auth-button--primary"
|
|
130
|
+
type="submit"
|
|
131
|
+
:disabled="!password || registrationConfirmPending || (!confirmationLinkToken && !confirmationCode.trim())"
|
|
132
|
+
>
|
|
133
|
+
{{ t("jskit.auth.login.confirmEmail.confirm") }}
|
|
134
|
+
</button>
|
|
135
|
+
<div v-if="confirmationUrl" class="auth-note">
|
|
136
|
+
<p>{{ t("jskit.auth.login.confirmEmail.devLink") }}</p>
|
|
137
|
+
<p class="auth-code">{{ confirmationUrl }}</p>
|
|
138
|
+
<button class="auth-button" type="button" :disabled="!password || registrationConfirmPending" @click="confirmRegistrationFromLink">
|
|
139
|
+
{{ t("jskit.auth.login.confirmEmail.useDevLink") }}
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="auth-row">
|
|
143
|
+
<button class="auth-button" type="button" @click="goToMainScreen">{{ t("jskit.auth.login.confirmEmail.goToMainScreen") }}</button>
|
|
144
|
+
<button
|
|
145
|
+
v-if="canResendEmailConfirmation"
|
|
146
|
+
class="auth-button"
|
|
147
|
+
type="button"
|
|
148
|
+
:disabled="registerConfirmationResendPending"
|
|
149
|
+
@click="resendRegisterConfirmationEmail"
|
|
150
|
+
>
|
|
151
|
+
{{ t("jskit.auth.login.confirmEmail.resend") }}
|
|
152
|
+
</button>
|
|
153
|
+
<button class="auth-link" type="button" @click="switchMode('login')">{{ t("jskit.auth.login.backToSignIn") }}</button>
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<template v-else>
|
|
158
|
+
<div v-if="showRememberedAccount" class="auth-note auth-row">
|
|
159
|
+
<div>
|
|
160
|
+
<p class="auth-strong">{{ t("jskit.auth.login.rememberedAccount.welcomeBack", { name: rememberedAccountDisplayName }) }}</p>
|
|
161
|
+
<p class="auth-muted">{{ rememberedAccountMaskedEmail }}</p>
|
|
162
|
+
</div>
|
|
163
|
+
<button class="auth-link" type="button" @click="switchAccount">{{ rememberedAccountSwitchLabel }}</button>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div v-if="isRegister && needsFirstAccountSetupCode" class="auth-field">
|
|
167
|
+
<p class="auth-note">{{ t("jskit.auth.login.firstAccount.explain") }}</p>
|
|
168
|
+
<label :for="`${id}-setup-code`">{{ t("jskit.auth.login.field.setupCode") }}</label>
|
|
169
|
+
<input :id="`${id}-setup-code`" v-model="setupCode" autocomplete="off" spellcheck="false">
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<div v-if="!isLogin || canUsePasswordLogin" class="auth-field">
|
|
173
|
+
<label :for="`${id}-email`">{{ t("jskit.auth.login.field.email") }}</label>
|
|
174
|
+
<input
|
|
175
|
+
:id="`${id}-email`"
|
|
176
|
+
v-model="email"
|
|
177
|
+
type="email"
|
|
178
|
+
autocomplete="email"
|
|
179
|
+
:aria-invalid="emailErrorMessages.length > 0"
|
|
180
|
+
:aria-describedby="`${id}-email-error`"
|
|
181
|
+
@blur="emailTouched = true"
|
|
182
|
+
>
|
|
183
|
+
<!-- Each field keeps its error line, so an error shown on blur moves nothing below it. -->
|
|
184
|
+
<p :id="`${id}-email-error`" class="auth-field__line auth-field__line--error">{{ emailErrorMessages[0] }}</p>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<div v-if="(isLogin && canUsePasswordLogin) || isRegister" class="auth-field">
|
|
188
|
+
<label :for="`${id}-password`">{{ t("jskit.auth.login.field.password") }}</label>
|
|
189
|
+
<input
|
|
190
|
+
:id="`${id}-password`"
|
|
191
|
+
v-model="password"
|
|
192
|
+
type="password"
|
|
193
|
+
:autocomplete="isRegister ? 'new-password' : 'current-password'"
|
|
194
|
+
:aria-invalid="passwordErrorMessages.length > 0"
|
|
195
|
+
:aria-describedby="`${id}-password-error`"
|
|
196
|
+
@blur="passwordTouched = true"
|
|
197
|
+
>
|
|
198
|
+
<p :id="`${id}-password-error`" class="auth-field__line auth-field__line--error">{{ passwordErrorMessages[0] }}</p>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<div v-if="isRegister" class="auth-field">
|
|
202
|
+
<label :for="`${id}-confirm-password`">{{ t("jskit.auth.login.field.confirmPassword") }}</label>
|
|
203
|
+
<input
|
|
204
|
+
:id="`${id}-confirm-password`"
|
|
205
|
+
v-model="confirmPassword"
|
|
206
|
+
type="password"
|
|
207
|
+
autocomplete="new-password"
|
|
208
|
+
:aria-invalid="confirmPasswordErrorMessages.length > 0"
|
|
209
|
+
:aria-describedby="`${id}-confirm-password-error`"
|
|
210
|
+
@blur="confirmPasswordTouched = true"
|
|
211
|
+
>
|
|
212
|
+
<p :id="`${id}-confirm-password-error`" class="auth-field__line auth-field__line--error">{{ confirmPasswordErrorMessages[0] }}</p>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<div v-if="isOtp" class="auth-field">
|
|
216
|
+
<label :for="`${id}-otp`">{{ t("jskit.auth.login.field.otpCode") }}</label>
|
|
217
|
+
<input
|
|
218
|
+
:id="`${id}-otp`"
|
|
219
|
+
v-model="otpCode"
|
|
220
|
+
autocomplete="one-time-code"
|
|
221
|
+
:aria-invalid="otpCodeErrorMessages.length > 0"
|
|
222
|
+
:aria-describedby="`${id}-otp-error`"
|
|
223
|
+
@blur="otpCodeTouched = true"
|
|
224
|
+
>
|
|
225
|
+
<p :id="`${id}-otp-error`" class="auth-field__line auth-field__line--error">{{ otpCodeErrorMessages[0] }}</p>
|
|
226
|
+
<button class="auth-button" type="button" :disabled="otpRequestPending" @click="requestOtpCode">
|
|
227
|
+
{{ t("jskit.auth.login.sendOtp") }}
|
|
228
|
+
</button>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div v-if="isLogin && (canRequestPasswordRecovery || canUseOtp)" class="auth-row auth-row--end">
|
|
232
|
+
<button v-if="canRequestPasswordRecovery" class="auth-link" type="button" @click="switchMode('forgot')">
|
|
233
|
+
{{ t("jskit.auth.login.forgotPassword") }}
|
|
234
|
+
</button>
|
|
235
|
+
<button v-if="canUseOtp" class="auth-link" type="button" @click="switchMode('otp')">{{ t("jskit.auth.login.useOtp") }}</button>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<label v-if="(isLogin && canUsePasswordLogin) || isOtp" class="auth-check">
|
|
239
|
+
<input v-model="rememberAccountOnDevice" type="checkbox">
|
|
240
|
+
{{ t("jskit.auth.login.rememberedAccount.rememberDevice") }}
|
|
241
|
+
</label>
|
|
242
|
+
|
|
243
|
+
<!-- Password sign-in paused for this address: the ways forward this app offers besides waiting. -->
|
|
244
|
+
<div v-if="isLogin && signInPausedMinutes > 0" class="auth-note" role="status">
|
|
245
|
+
<p>{{ t("jskit.auth.login.signInPaused.wait", { count: signInPausedMinutes }) }}</p>
|
|
246
|
+
<div v-if="canRequestPasswordRecovery || canRegister" class="auth-row">
|
|
247
|
+
<button v-if="canRequestPasswordRecovery" class="auth-button" type="button" @click="switchMode('forgot')">
|
|
248
|
+
{{ t("jskit.auth.login.signInPaused.resetPassword") }}
|
|
249
|
+
</button>
|
|
250
|
+
<button v-if="canRegister" class="auth-button" type="button" @click="switchMode('register')">
|
|
251
|
+
{{ t("jskit.auth.login.signInPaused.register") }}
|
|
252
|
+
</button>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<button
|
|
257
|
+
v-if="!isLogin || canUsePasswordLogin"
|
|
258
|
+
class="auth-button auth-button--primary"
|
|
259
|
+
type="submit"
|
|
260
|
+
:disabled="!canSubmit"
|
|
261
|
+
>
|
|
262
|
+
{{ submitLabel }}
|
|
263
|
+
</button>
|
|
264
|
+
|
|
265
|
+
<div v-if="canUseOAuth && (isLogin || isRegister)" class="auth-providers">
|
|
266
|
+
<!-- A provider sign-in that took too long: start it again, to the same page. -->
|
|
267
|
+
<button v-if="oauthRetryProvider" class="auth-button" type="button" :disabled="loading" @click="startOAuthSignIn(oauthRetryProvider)">
|
|
268
|
+
{{ t("jskit.auth.login.oauth.tryAgain", { provider: providerName(oauthRetryProvider) }) }}
|
|
269
|
+
</button>
|
|
270
|
+
<button
|
|
271
|
+
v-for="provider in oauthProviders"
|
|
272
|
+
:key="provider.id"
|
|
273
|
+
class="auth-button"
|
|
274
|
+
type="button"
|
|
275
|
+
:disabled="loading"
|
|
276
|
+
@click="startOAuthSignIn(provider.id)"
|
|
277
|
+
>
|
|
278
|
+
{{ oauthProviderButtonLabel(provider) }}
|
|
279
|
+
</button>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div v-if="isForgot || isOtp" class="auth-row">
|
|
283
|
+
<span class="auth-muted">{{ isForgot ? t("jskit.auth.login.rememberedPassword") : t("jskit.auth.login.otherMethod") }}</span>
|
|
284
|
+
<button class="auth-link" type="button" @click="switchMode('login')">{{ t("jskit.auth.login.backToSignIn") }}</button>
|
|
285
|
+
</div>
|
|
286
|
+
</template>
|
|
287
|
+
</form>
|
|
288
|
+
</section>
|
|
289
|
+
</main>
|
|
290
|
+
</template>
|
|
291
|
+
|
|
292
|
+
<style scoped>
|
|
293
|
+
/* Every colour, radius and font is one of the app's design tokens (src/theme/tokens.css). */
|
|
294
|
+
.auth-page {
|
|
295
|
+
display: grid;
|
|
296
|
+
place-items: center;
|
|
297
|
+
min-height: 100dvh;
|
|
298
|
+
padding: 24px 16px;
|
|
299
|
+
background: var(--ds-page);
|
|
300
|
+
color: var(--ds-text);
|
|
301
|
+
font-family: var(--ds-font);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.auth-panel {
|
|
305
|
+
display: grid;
|
|
306
|
+
gap: 16px;
|
|
307
|
+
width: min(420px, 100%);
|
|
308
|
+
padding: 32px;
|
|
309
|
+
border-radius: var(--ds-radius-large);
|
|
310
|
+
background: var(--ds-panel);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.auth-title {
|
|
314
|
+
margin: 0;
|
|
315
|
+
font-size: 1.75rem;
|
|
316
|
+
font-weight: 700;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.auth-muted,
|
|
320
|
+
.auth-note p,
|
|
321
|
+
.auth-panel p {
|
|
322
|
+
margin: 0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.auth-muted {
|
|
326
|
+
color: var(--ds-text-muted);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.auth-strong {
|
|
330
|
+
font-weight: 600;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.auth-tabs {
|
|
334
|
+
display: grid;
|
|
335
|
+
grid-template-columns: 1fr 1fr;
|
|
336
|
+
padding: 4px;
|
|
337
|
+
border-radius: var(--ds-radius);
|
|
338
|
+
background: var(--ds-page);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.auth-tabs button {
|
|
342
|
+
padding: 8px;
|
|
343
|
+
border: 0;
|
|
344
|
+
border-radius: var(--ds-radius);
|
|
345
|
+
background: transparent;
|
|
346
|
+
color: inherit;
|
|
347
|
+
font: inherit;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.auth-tabs button[aria-checked="true"] {
|
|
352
|
+
background: var(--ds-panel);
|
|
353
|
+
font-weight: 600;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.auth-form {
|
|
357
|
+
display: grid;
|
|
358
|
+
gap: 12px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.auth-field {
|
|
362
|
+
display: grid;
|
|
363
|
+
gap: 4px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.auth-field label {
|
|
367
|
+
font-weight: 600;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.auth-field input {
|
|
371
|
+
padding: 10px 12px;
|
|
372
|
+
border: 1px solid var(--ds-line);
|
|
373
|
+
border-radius: var(--ds-radius);
|
|
374
|
+
background: var(--ds-panel);
|
|
375
|
+
color: inherit;
|
|
376
|
+
font: inherit;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.auth-field input:focus-visible,
|
|
380
|
+
.auth-button:focus-visible,
|
|
381
|
+
.auth-link:focus-visible,
|
|
382
|
+
.auth-tabs button:focus-visible {
|
|
383
|
+
outline: 2px solid var(--ds-accent);
|
|
384
|
+
outline-offset: 2px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.auth-field input[aria-invalid="true"] {
|
|
388
|
+
border-color: var(--ds-danger);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.auth-field__line {
|
|
392
|
+
min-height: 1.25em;
|
|
393
|
+
margin: 0;
|
|
394
|
+
color: var(--ds-text-muted);
|
|
395
|
+
font-size: 0.875rem;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.auth-field__line--error {
|
|
399
|
+
color: var(--ds-danger);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.auth-button {
|
|
403
|
+
min-height: 44px;
|
|
404
|
+
padding: 10px 16px;
|
|
405
|
+
border: 1px solid var(--ds-line);
|
|
406
|
+
border-radius: var(--ds-radius);
|
|
407
|
+
background: var(--ds-panel);
|
|
408
|
+
color: inherit;
|
|
409
|
+
font: inherit;
|
|
410
|
+
font-weight: 600;
|
|
411
|
+
cursor: pointer;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.auth-button--primary {
|
|
415
|
+
border-color: var(--ds-accent);
|
|
416
|
+
background: var(--ds-accent);
|
|
417
|
+
color: var(--ds-on-accent);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.auth-button:disabled {
|
|
421
|
+
opacity: 0.5;
|
|
422
|
+
cursor: default;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.auth-link {
|
|
426
|
+
padding: 4px 0;
|
|
427
|
+
border: 0;
|
|
428
|
+
background: none;
|
|
429
|
+
color: var(--ds-accent);
|
|
430
|
+
font: inherit;
|
|
431
|
+
cursor: pointer;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.auth-row {
|
|
435
|
+
display: flex;
|
|
436
|
+
flex-wrap: wrap;
|
|
437
|
+
gap: 12px;
|
|
438
|
+
align-items: center;
|
|
439
|
+
justify-content: space-between;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.auth-row--end {
|
|
443
|
+
justify-content: flex-end;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.auth-providers {
|
|
447
|
+
display: grid;
|
|
448
|
+
gap: 8px;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.auth-check {
|
|
452
|
+
display: flex;
|
|
453
|
+
gap: 8px;
|
|
454
|
+
align-items: center;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.auth-note,
|
|
458
|
+
.auth-message {
|
|
459
|
+
padding: 12px 16px;
|
|
460
|
+
border-radius: var(--ds-radius);
|
|
461
|
+
background: var(--ds-page);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.auth-message--error {
|
|
465
|
+
background: var(--ds-danger-soft);
|
|
466
|
+
color: var(--ds-danger);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.auth-code {
|
|
470
|
+
font-family: monospace;
|
|
471
|
+
overflow-wrap: anywhere;
|
|
472
|
+
}
|
|
473
|
+
</style>
|