@jskit-ai/auth-web 0.2.15 → 0.2.16
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/CHANGELOG.md +7 -0
- package/fixtures/sign-in/main.js +24 -1
- package/fixtures/sign-in/vite.config.mjs +2 -0
- package/locales/en.json +2 -1
- package/package.json +7 -7
- package/patterns/auth-surface/PATTERN.md +18 -5
- package/patterns/auth-surface/example/src/components/AppBrand.vue +17 -0
- package/patterns/auth-surface/example/src/pages/auth/login.vue +2 -2
- package/patterns/auth-surface/example/src/pages/auth/reset-password.vue +2 -2
- package/patterns/auth-surface/example/src/pages/auth/signout.vue +2 -2
- package/patterns/auth-surface/example/src/views/auth/LoginView.vue +6 -1
- package/patterns/auth-surface/example/src/views/auth/ResetPasswordView.vue +6 -1
- package/patterns/auth-surface/example/src/views/auth/SignOutView.vue +6 -1
- package/src/client/composables/loginView/constants.js +2 -2
- package/src/client/composables/loginView/useLoginViewState.js +5 -1
- package/src/client/views/AuthProfileWidget.vue +28 -2
- package/src/client/views/AuthScreen.vue +98 -0
- package/src/client/views/DefaultLoginView.vue +294 -290
- package/src/client/views/DefaultResetPasswordView.vue +61 -85
- package/src/client/views/DefaultSignOutView.vue +62 -43
- package/test/authSurfacePatternBrand.test.js +34 -0
- package/test/clientSurface.test.js +29 -26
- package/test/signIn.browser.test.js +214 -0
|
@@ -1,298 +1,299 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<v-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<AuthScreen class="login-screen" :class="{ 'login-screen--mobile': isMobileViewport }">
|
|
3
|
+
<template v-if="$slots.brand" #brand="brand">
|
|
4
|
+
<slot name="brand" v-bind="brand" />
|
|
5
|
+
</template>
|
|
6
|
+
<v-card
|
|
7
|
+
class="auth-card"
|
|
8
|
+
:class="{ 'auth-card--mobile': isMobileViewport }"
|
|
9
|
+
variant="flat"
|
|
10
|
+
:rounded="isMobileViewport ? false : undefined"
|
|
11
11
|
>
|
|
12
|
-
<v-card
|
|
13
|
-
class="auth-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
>
|
|
18
|
-
<v-card-text class="auth-content" :class="{ 'auth-content--mobile': isMobileViewport }">
|
|
19
|
-
<div v-if="authTitle || authSubtitle" class="auth-header mb-5">
|
|
20
|
-
<div>
|
|
21
|
-
<h1 v-if="authTitle" class="auth-title text-headline-medium">{{ authTitle }}</h1>
|
|
22
|
-
<p v-if="authSubtitle" class="on-surface-variant mb-0">{{ authSubtitle }}</p>
|
|
23
|
-
</div>
|
|
12
|
+
<v-card-text class="auth-content" :class="{ 'auth-content--mobile': isMobileViewport }">
|
|
13
|
+
<div v-if="authTitle || authSubtitle" class="auth-header mb-5">
|
|
14
|
+
<div>
|
|
15
|
+
<h1 v-if="authTitle" class="auth-title text-headline-medium">{{ authTitle }}</h1>
|
|
16
|
+
<p v-if="authSubtitle" class="on-surface-variant mb-0">{{ authSubtitle }}</p>
|
|
24
17
|
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<!-- Sign in and Register: a Material 3 segmented button, offered only when both are. -->
|
|
21
|
+
<div
|
|
22
|
+
v-if="!isForgot && !isOtp && !isEmailConfirmationPending && !showRememberedAccount && canRegister"
|
|
23
|
+
class="mode-switch mb-5"
|
|
24
|
+
role="radiogroup"
|
|
25
|
+
:aria-label="t('jskit.auth.login.mode.label')"
|
|
26
|
+
data-testid="auth-mode-switch"
|
|
27
|
+
>
|
|
28
|
+
<v-btn
|
|
29
|
+
data-testid="auth-mode-sign-in"
|
|
30
|
+
class="mode-switch__segment text-none"
|
|
31
|
+
role="radio"
|
|
32
|
+
:aria-checked="isLogin ? 'true' : 'false'"
|
|
33
|
+
:active="isLogin"
|
|
34
|
+
:prepend-icon="isLogin ? '$complete' : undefined"
|
|
35
|
+
variant="text"
|
|
36
|
+
rounded="0"
|
|
37
|
+
@click="switchMode('login')"
|
|
38
|
+
>
|
|
39
|
+
{{ t("jskit.auth.login.mode.signIn") }}
|
|
40
|
+
</v-btn>
|
|
41
|
+
<v-btn
|
|
42
|
+
data-testid="auth-mode-register"
|
|
43
|
+
class="mode-switch__segment text-none"
|
|
44
|
+
role="radio"
|
|
45
|
+
:aria-checked="isRegister ? 'true' : 'false'"
|
|
46
|
+
:active="isRegister"
|
|
47
|
+
:prepend-icon="isRegister ? '$complete' : undefined"
|
|
48
|
+
variant="text"
|
|
49
|
+
rounded="0"
|
|
50
|
+
@click="switchMode('register')"
|
|
51
|
+
>
|
|
52
|
+
{{ t("jskit.auth.login.mode.register") }}
|
|
53
|
+
</v-btn>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<v-form @submit.prevent="submitAuth" novalidate>
|
|
57
|
+
<template v-if="isEmailConfirmationPending">
|
|
58
|
+
<div class="email-confirmation-state mb-5">
|
|
59
|
+
<p class="email-confirmation-message text-body-medium mb-0">
|
|
60
|
+
{{ emailConfirmationMessage }}
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
25
63
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<v-btn
|
|
37
|
-
v-if="!showRememberedAccount && canRegister"
|
|
38
|
-
data-testid="auth-mode-register"
|
|
39
|
-
class="text-none"
|
|
40
|
-
:variant="isRegister ? 'flat' : 'text'"
|
|
41
|
-
:color="isRegister ? 'secondary-container' : undefined"
|
|
42
|
-
@click="switchMode('register')"
|
|
43
|
-
>
|
|
44
|
-
{{ t("jskit.auth.login.mode.register") }}
|
|
45
|
-
</v-btn>
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<v-form @submit.prevent="submitAuth" novalidate>
|
|
49
|
-
<template v-if="isEmailConfirmationPending">
|
|
50
|
-
<div class="email-confirmation-state mb-5">
|
|
51
|
-
<p class="email-confirmation-message text-body-medium mb-0">
|
|
52
|
-
{{ emailConfirmationMessage }}
|
|
53
|
-
</p>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div v-if="confirmationUrl" class="email-confirmation-dev-link mb-5" data-testid="auth-confirmation-dev-link">
|
|
57
|
-
<p class="text-body-medium on-surface-variant mb-2">{{ t("jskit.auth.login.confirmEmail.devLink") }}</p>
|
|
58
|
-
<p class="email-confirmation-url text-body-small mb-3">{{ confirmationUrl }}</p>
|
|
59
|
-
<v-btn
|
|
60
|
-
class="text-none"
|
|
61
|
-
variant="flat"
|
|
62
|
-
color="primary"
|
|
63
|
-
data-testid="auth-confirmation-dev-confirm"
|
|
64
|
-
:loading="registrationConfirmPending"
|
|
65
|
-
@click="confirmRegistrationFromLink"
|
|
66
|
-
>
|
|
67
|
-
{{ t("jskit.auth.login.confirmEmail.useDevLink") }}
|
|
68
|
-
</v-btn>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div v-if="canEnterConfirmationCode" class="email-confirmation-code d-flex align-start ga-2 mb-5">
|
|
72
|
-
<v-text-field
|
|
73
|
-
v-model="confirmationCode"
|
|
74
|
-
data-testid="auth-confirmation-code"
|
|
75
|
-
:label="t('jskit.auth.login.field.confirmationCode')"
|
|
76
|
-
variant="outlined"
|
|
77
|
-
density="comfortable"
|
|
78
|
-
autocomplete="off"
|
|
79
|
-
hide-details="auto"
|
|
80
|
-
/>
|
|
81
|
-
<v-btn
|
|
82
|
-
class="text-none mt-1"
|
|
83
|
-
variant="tonal"
|
|
84
|
-
color="primary"
|
|
85
|
-
size="large"
|
|
86
|
-
type="submit"
|
|
87
|
-
data-testid="auth-confirmation-submit"
|
|
88
|
-
:disabled="!confirmationCode.trim()"
|
|
89
|
-
:loading="registrationConfirmPending"
|
|
90
|
-
>
|
|
91
|
-
{{ t("jskit.auth.login.confirmEmail.confirm") }}
|
|
92
|
-
</v-btn>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div class="switch-row d-flex align-center justify-space-between ga-3">
|
|
96
|
-
<v-btn class="text-none" variant="tonal" color="primary" @click="goToMainScreen">
|
|
97
|
-
{{ t("jskit.auth.login.confirmEmail.goToMainScreen") }}
|
|
98
|
-
</v-btn>
|
|
99
|
-
<v-btn
|
|
100
|
-
v-if="canResendEmailConfirmation"
|
|
101
|
-
class="text-none"
|
|
102
|
-
variant="outlined"
|
|
103
|
-
color="secondary"
|
|
104
|
-
:loading="registerConfirmationResendPending"
|
|
105
|
-
@click="resendRegisterConfirmationEmail"
|
|
106
|
-
>
|
|
107
|
-
{{ t("jskit.auth.login.confirmEmail.resend") }}
|
|
108
|
-
</v-btn>
|
|
109
|
-
<v-btn variant="text" color="secondary" @click="switchMode('login')">
|
|
110
|
-
{{ t("jskit.auth.login.backToSignIn") }}
|
|
111
|
-
</v-btn>
|
|
112
|
-
</div>
|
|
113
|
-
</template>
|
|
114
|
-
|
|
115
|
-
<template v-else>
|
|
116
|
-
<div
|
|
117
|
-
v-if="showRememberedAccount"
|
|
118
|
-
class="remembered-account d-flex align-center justify-space-between ga-3 mb-4"
|
|
119
|
-
>
|
|
120
|
-
<div class="remembered-copy flex-grow-1">
|
|
121
|
-
<p class="remembered-title text-title-small">
|
|
122
|
-
{{ t("jskit.auth.login.rememberedAccount.welcomeBack", { name: rememberedAccountDisplayName }) }}
|
|
123
|
-
</p>
|
|
124
|
-
<p class="remembered-email text-body-small">{{ rememberedAccountMaskedEmail }}</p>
|
|
125
|
-
</div>
|
|
126
|
-
<v-btn variant="text" color="secondary" class="text-none" @click="switchAccount">
|
|
127
|
-
{{ rememberedAccountSwitchLabel }}
|
|
128
|
-
</v-btn>
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
<div
|
|
132
|
-
v-if="isRegister && needsFirstAccountSetupCode"
|
|
133
|
-
class="first-account-setup mb-4"
|
|
134
|
-
data-testid="auth-first-account-setup"
|
|
64
|
+
<div v-if="confirmationUrl" class="email-confirmation-dev-link mb-5" data-testid="auth-confirmation-dev-link">
|
|
65
|
+
<p class="text-body-medium on-surface-variant mb-2">{{ t("jskit.auth.login.confirmEmail.devLink") }}</p>
|
|
66
|
+
<p class="email-confirmation-url text-body-small mb-3">{{ confirmationUrl }}</p>
|
|
67
|
+
<v-btn
|
|
68
|
+
class="text-none"
|
|
69
|
+
variant="flat"
|
|
70
|
+
color="primary"
|
|
71
|
+
data-testid="auth-confirmation-dev-confirm"
|
|
72
|
+
:loading="registrationConfirmPending"
|
|
73
|
+
@click="confirmRegistrationFromLink"
|
|
135
74
|
>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
:label="t('jskit.auth.login.field.setupCode')"
|
|
140
|
-
variant="outlined"
|
|
141
|
-
density="comfortable"
|
|
142
|
-
autocomplete="off"
|
|
143
|
-
spellcheck="false"
|
|
144
|
-
hide-details="auto"
|
|
145
|
-
/>
|
|
146
|
-
</div>
|
|
75
|
+
{{ t("jskit.auth.login.confirmEmail.useDevLink") }}
|
|
76
|
+
</v-btn>
|
|
77
|
+
</div>
|
|
147
78
|
|
|
79
|
+
<div v-if="canEnterConfirmationCode" class="email-confirmation-code d-flex align-start ga-2 mb-5">
|
|
148
80
|
<v-text-field
|
|
149
|
-
v-
|
|
150
|
-
|
|
151
|
-
:label="t('jskit.auth.login.field.
|
|
81
|
+
v-model="confirmationCode"
|
|
82
|
+
data-testid="auth-confirmation-code"
|
|
83
|
+
:label="t('jskit.auth.login.field.confirmationCode')"
|
|
152
84
|
variant="outlined"
|
|
153
85
|
density="comfortable"
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
:error-messages="emailErrorMessages"
|
|
157
|
-
@blur="emailTouched = true"
|
|
158
|
-
class="mb-3"
|
|
86
|
+
autocomplete="off"
|
|
87
|
+
hide-details="auto"
|
|
159
88
|
/>
|
|
89
|
+
<v-btn
|
|
90
|
+
class="text-none mt-1"
|
|
91
|
+
variant="tonal"
|
|
92
|
+
color="primary"
|
|
93
|
+
size="large"
|
|
94
|
+
type="submit"
|
|
95
|
+
data-testid="auth-confirmation-submit"
|
|
96
|
+
:disabled="!confirmationCode.trim()"
|
|
97
|
+
:loading="registrationConfirmPending"
|
|
98
|
+
>
|
|
99
|
+
{{ t("jskit.auth.login.confirmEmail.confirm") }}
|
|
100
|
+
</v-btn>
|
|
101
|
+
</div>
|
|
160
102
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
103
|
+
<div class="switch-row d-flex align-center justify-space-between ga-3">
|
|
104
|
+
<v-btn class="text-none" variant="tonal" color="primary" @click="goToMainScreen">
|
|
105
|
+
{{ t("jskit.auth.login.confirmEmail.goToMainScreen") }}
|
|
106
|
+
</v-btn>
|
|
107
|
+
<v-btn
|
|
108
|
+
v-if="canResendEmailConfirmation"
|
|
109
|
+
class="text-none"
|
|
166
110
|
variant="outlined"
|
|
167
|
-
|
|
168
|
-
:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
111
|
+
color="secondary"
|
|
112
|
+
:loading="registerConfirmationResendPending"
|
|
113
|
+
@click="resendRegisterConfirmationEmail"
|
|
114
|
+
>
|
|
115
|
+
{{ t("jskit.auth.login.confirmEmail.resend") }}
|
|
116
|
+
</v-btn>
|
|
117
|
+
<v-btn variant="text" color="secondary" @click="switchMode('login')">
|
|
118
|
+
{{ t("jskit.auth.login.backToSignIn") }}
|
|
119
|
+
</v-btn>
|
|
120
|
+
</div>
|
|
121
|
+
</template>
|
|
175
122
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
123
|
+
<template v-else>
|
|
124
|
+
<div
|
|
125
|
+
v-if="showRememberedAccount"
|
|
126
|
+
class="remembered-account d-flex align-center justify-space-between ga-3 mb-4"
|
|
127
|
+
>
|
|
128
|
+
<div class="remembered-copy flex-grow-1">
|
|
129
|
+
<p class="remembered-title text-title-small">
|
|
130
|
+
{{ t("jskit.auth.login.rememberedAccount.welcomeBack", { name: rememberedAccountDisplayName }) }}
|
|
131
|
+
</p>
|
|
132
|
+
<p class="remembered-email text-body-small">{{ rememberedAccountMaskedEmail }}</p>
|
|
133
|
+
</div>
|
|
134
|
+
<v-btn variant="text" color="secondary" class="text-none" @click="switchAccount">
|
|
135
|
+
{{ rememberedAccountSwitchLabel }}
|
|
136
|
+
</v-btn>
|
|
137
|
+
</div>
|
|
190
138
|
|
|
139
|
+
<div
|
|
140
|
+
v-if="isRegister && needsFirstAccountSetupCode"
|
|
141
|
+
class="first-account-setup mb-4"
|
|
142
|
+
data-testid="auth-first-account-setup"
|
|
143
|
+
>
|
|
144
|
+
<p class="text-body-medium mb-3">{{ t("jskit.auth.login.firstAccount.explain") }}</p>
|
|
191
145
|
<v-text-field
|
|
192
|
-
v-
|
|
193
|
-
|
|
194
|
-
:label="t('jskit.auth.login.field.otpCode')"
|
|
146
|
+
v-model="setupCode"
|
|
147
|
+
:label="t('jskit.auth.login.field.setupCode')"
|
|
195
148
|
variant="outlined"
|
|
196
149
|
density="comfortable"
|
|
197
|
-
autocomplete="
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
class="mb-3"
|
|
150
|
+
autocomplete="off"
|
|
151
|
+
spellcheck="false"
|
|
152
|
+
hide-details="auto"
|
|
201
153
|
/>
|
|
154
|
+
</div>
|
|
202
155
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
156
|
+
<v-text-field
|
|
157
|
+
v-if="!isLogin || canUsePasswordLogin"
|
|
158
|
+
v-model="email"
|
|
159
|
+
:label="t('jskit.auth.login.field.email')"
|
|
160
|
+
variant="outlined"
|
|
161
|
+
density="comfortable"
|
|
162
|
+
type="email"
|
|
163
|
+
autocomplete="email"
|
|
164
|
+
:error-messages="emailErrorMessages"
|
|
165
|
+
@blur="emailTouched = true"
|
|
166
|
+
class="mb-3"
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
<v-text-field
|
|
170
|
+
v-if="(isLogin && canUsePasswordLogin) || isRegister"
|
|
171
|
+
v-model="password"
|
|
172
|
+
:label="t('jskit.auth.login.field.password')"
|
|
173
|
+
:type="showPassword ? 'text' : 'password'"
|
|
174
|
+
variant="outlined"
|
|
175
|
+
density="comfortable"
|
|
176
|
+
:autocomplete="isRegister ? 'new-password' : 'current-password'"
|
|
177
|
+
:error-messages="passwordErrorMessages"
|
|
178
|
+
:append-inner-icon="showPassword ? '$visibilityOff' : '$visibility'"
|
|
179
|
+
@click:append-inner="togglePasswordVisibility"
|
|
180
|
+
@blur="passwordTouched = true"
|
|
181
|
+
class="mb-3"
|
|
182
|
+
/>
|
|
183
|
+
|
|
184
|
+
<v-text-field
|
|
185
|
+
v-if="isRegister"
|
|
186
|
+
v-model="confirmPassword"
|
|
187
|
+
:label="t('jskit.auth.login.field.confirmPassword')"
|
|
188
|
+
:type="showConfirmPassword ? 'text' : 'password'"
|
|
189
|
+
variant="outlined"
|
|
190
|
+
density="comfortable"
|
|
191
|
+
autocomplete="new-password"
|
|
192
|
+
:error-messages="confirmPasswordErrorMessages"
|
|
193
|
+
:append-inner-icon="showConfirmPassword ? '$visibilityOff' : '$visibility'"
|
|
194
|
+
@click:append-inner="toggleConfirmPasswordVisibility"
|
|
195
|
+
@blur="confirmPasswordTouched = true"
|
|
196
|
+
class="mb-3"
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
<v-text-field
|
|
200
|
+
v-if="isOtp"
|
|
201
|
+
v-model="otpCode"
|
|
202
|
+
:label="t('jskit.auth.login.field.otpCode')"
|
|
203
|
+
variant="outlined"
|
|
204
|
+
density="comfortable"
|
|
205
|
+
autocomplete="one-time-code"
|
|
206
|
+
:error-messages="otpCodeErrorMessages"
|
|
207
|
+
@blur="otpCodeTouched = true"
|
|
208
|
+
class="mb-3"
|
|
209
|
+
/>
|
|
210
|
+
|
|
211
|
+
<div v-if="isLogin && (canRequestPasswordRecovery || canUseOtp)" class="aux-links d-flex justify-end mb-4">
|
|
212
|
+
<v-btn
|
|
213
|
+
v-if="canRequestPasswordRecovery"
|
|
214
|
+
variant="text"
|
|
215
|
+
color="secondary"
|
|
216
|
+
@click="switchMode('forgot')"
|
|
217
|
+
>
|
|
218
|
+
{{ t("jskit.auth.login.forgotPassword") }}
|
|
219
|
+
</v-btn>
|
|
220
|
+
<v-btn v-if="canUseOtp" variant="text" color="secondary" @click="switchMode('otp')">
|
|
221
|
+
{{ t("jskit.auth.login.useOtp") }}
|
|
222
|
+
</v-btn>
|
|
223
|
+
</div>
|
|
216
224
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
<v-checkbox
|
|
226
|
+
v-if="(isLogin && canUsePasswordLogin) || isOtp"
|
|
227
|
+
v-model="rememberAccountOnDevice"
|
|
228
|
+
:label="t('jskit.auth.login.rememberedAccount.rememberDevice')"
|
|
229
|
+
density="compact"
|
|
230
|
+
hide-details
|
|
231
|
+
class="mb-4"
|
|
232
|
+
/>
|
|
225
233
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
<div v-if="isOtp" class="aux-links d-flex justify-end mb-4">
|
|
235
|
+
<v-btn
|
|
236
|
+
type="button"
|
|
237
|
+
variant="tonal"
|
|
238
|
+
color="secondary"
|
|
239
|
+
:loading="otpRequestPending"
|
|
240
|
+
@click="requestOtpCode"
|
|
241
|
+
>
|
|
242
|
+
{{ t("jskit.auth.login.sendOtp") }}
|
|
243
|
+
</v-btn>
|
|
244
|
+
</div>
|
|
237
245
|
|
|
238
|
-
|
|
239
|
-
<v-btn
|
|
240
|
-
v-for="provider in oauthProviders"
|
|
241
|
-
:key="provider.id"
|
|
242
|
-
block
|
|
243
|
-
variant="outlined"
|
|
244
|
-
color="secondary"
|
|
245
|
-
:disabled="loading"
|
|
246
|
-
:prepend-icon="oauthProviderIcon(provider)"
|
|
247
|
-
class="text-none oauth-provider-button"
|
|
248
|
-
@click="startOAuthSignIn(provider.id)"
|
|
249
|
-
>
|
|
250
|
-
{{ oauthProviderButtonLabel(provider) }}
|
|
251
|
-
</v-btn>
|
|
252
|
-
</div>
|
|
246
|
+
<div v-if="canUseOAuth && (isLogin || isRegister)" class="oauth-actions d-grid ga-2 mb-4">
|
|
253
247
|
<v-btn
|
|
254
|
-
v-
|
|
255
|
-
|
|
248
|
+
v-for="provider in oauthProviders"
|
|
249
|
+
:key="provider.id"
|
|
256
250
|
block
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
:
|
|
260
|
-
:
|
|
261
|
-
|
|
251
|
+
variant="outlined"
|
|
252
|
+
color="secondary"
|
|
253
|
+
:disabled="loading"
|
|
254
|
+
:prepend-icon="oauthProviderIcon(provider)"
|
|
255
|
+
class="text-none oauth-provider-button"
|
|
256
|
+
@click="startOAuthSignIn(provider.id)"
|
|
262
257
|
>
|
|
263
|
-
{{
|
|
258
|
+
{{ oauthProviderButtonLabel(provider) }}
|
|
264
259
|
</v-btn>
|
|
260
|
+
</div>
|
|
261
|
+
<v-btn
|
|
262
|
+
v-if="!isLogin || canUsePasswordLogin"
|
|
263
|
+
data-testid="auth-submit"
|
|
264
|
+
block
|
|
265
|
+
color="primary"
|
|
266
|
+
size="large"
|
|
267
|
+
:loading="loading"
|
|
268
|
+
:disabled="!canSubmit"
|
|
269
|
+
type="submit"
|
|
270
|
+
>
|
|
271
|
+
{{ submitLabel }}
|
|
272
|
+
</v-btn>
|
|
265
273
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
<div v-else-if="isForgot" class="switch-row mt-4 d-flex align-center justify-space-between ga-3">
|
|
274
|
-
<span class="on-surface-variant">{{ t("jskit.auth.login.rememberedPassword") }}</span>
|
|
275
|
-
<v-btn variant="text" color="secondary" @click="switchMode('login')">
|
|
276
|
-
{{ t("jskit.auth.login.backToSignIn") }}
|
|
277
|
-
</v-btn>
|
|
278
|
-
</div>
|
|
274
|
+
<div v-if="isForgot" class="switch-row mt-4 d-flex align-center justify-space-between ga-3">
|
|
275
|
+
<span class="on-surface-variant">{{ t("jskit.auth.login.rememberedPassword") }}</span>
|
|
276
|
+
<v-btn variant="text" color="secondary" @click="switchMode('login')">
|
|
277
|
+
{{ t("jskit.auth.login.backToSignIn") }}
|
|
278
|
+
</v-btn>
|
|
279
|
+
</div>
|
|
279
280
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
</div>
|
|
281
|
+
<div v-else-if="isOtp" class="switch-row mt-4 d-flex align-center justify-space-between ga-3">
|
|
282
|
+
<span class="on-surface-variant">{{ t("jskit.auth.login.otherMethod") }}</span>
|
|
283
|
+
<v-btn variant="text" color="secondary" @click="switchMode('login')">
|
|
284
|
+
{{ t("jskit.auth.login.backToSignIn") }}
|
|
285
|
+
</v-btn>
|
|
286
|
+
</div>
|
|
287
|
+
</template>
|
|
288
|
+
</v-form>
|
|
289
|
+
</v-card-text>
|
|
290
|
+
</v-card>
|
|
291
|
+
</AuthScreen>
|
|
292
292
|
</template>
|
|
293
293
|
|
|
294
294
|
<script setup>
|
|
295
295
|
import { useDisplay } from "vuetify";
|
|
296
|
+
import AuthScreen from "./AuthScreen.vue";
|
|
296
297
|
import { useLoginView } from "../runtime/useLoginView.js";
|
|
297
298
|
import { useJskitText } from "../i18n.js";
|
|
298
299
|
|
|
@@ -367,36 +368,14 @@ function toggleConfirmPasswordVisibility() {
|
|
|
367
368
|
</script>
|
|
368
369
|
|
|
369
370
|
<style scoped>
|
|
370
|
-
.login-screen {
|
|
371
|
-
/* Start below shell banners shown on a surface without an app bar. */
|
|
372
|
-
--auth-screen-height: calc(100dvh - var(--shell-error-banners-inline-height, 0px));
|
|
373
|
-
position: fixed;
|
|
374
|
-
inset: var(--shell-error-banners-inline-height, 0px) 0 0;
|
|
375
|
-
z-index: 1;
|
|
376
|
-
overflow-y: auto;
|
|
377
|
-
min-height: var(--auth-screen-height);
|
|
378
|
-
background-color: rgb(var(--v-theme-surface-container));
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.login-screen--mobile {
|
|
382
|
-
background-color: rgb(var(--v-theme-surface));
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.login-shell {
|
|
386
|
-
min-height: var(--auth-screen-height);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.login-shell--mobile {
|
|
390
|
-
width: 100%;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
371
|
.auth-card {
|
|
394
372
|
width: min(520px, 100%);
|
|
395
373
|
}
|
|
396
374
|
|
|
375
|
+
/* On a phone the card is the screen below the brand row, if any. */
|
|
397
376
|
.auth-card--mobile {
|
|
377
|
+
flex: 1 0 auto;
|
|
398
378
|
width: 100%;
|
|
399
|
-
min-height: var(--auth-screen-height);
|
|
400
379
|
}
|
|
401
380
|
|
|
402
381
|
.auth-content {
|
|
@@ -404,8 +383,7 @@ function toggleConfirmPasswordVisibility() {
|
|
|
404
383
|
}
|
|
405
384
|
|
|
406
385
|
.auth-content--mobile {
|
|
407
|
-
|
|
408
|
-
padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(32px + env(safe-area-inset-bottom, 0px));
|
|
386
|
+
padding: calc(24px + var(--auth-screen-top-inset, 0px)) 20px calc(32px + env(safe-area-inset-bottom, 0px));
|
|
409
387
|
}
|
|
410
388
|
|
|
411
389
|
.auth-title {
|
|
@@ -413,9 +391,35 @@ function toggleConfirmPasswordVisibility() {
|
|
|
413
391
|
color: rgb(var(--v-theme-on-surface));
|
|
414
392
|
}
|
|
415
393
|
|
|
394
|
+
/* Material 3's segmented button: one outline, equal segments, the selected one in secondary-container with a check. */
|
|
395
|
+
/* Two equal grid columns: the divider sits inside the second segment, so it can't make the segments differ. */
|
|
416
396
|
.mode-switch {
|
|
397
|
+
display: grid;
|
|
398
|
+
grid-template-columns: 1fr 1fr;
|
|
399
|
+
height: 40px;
|
|
400
|
+
overflow: hidden;
|
|
401
|
+
border: 1px solid rgb(var(--v-theme-outline));
|
|
417
402
|
border-radius: 9999px;
|
|
418
|
-
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.mode-switch__segment.v-btn {
|
|
406
|
+
min-width: 0;
|
|
407
|
+
height: 100%;
|
|
408
|
+
color: rgb(var(--v-theme-on-surface));
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.mode-switch__segment + .mode-switch__segment {
|
|
412
|
+
border-inline-start: 1px solid rgb(var(--v-theme-outline));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.mode-switch__segment.v-btn--active {
|
|
416
|
+
background-color: rgb(var(--v-theme-secondary-container));
|
|
417
|
+
color: rgb(var(--v-theme-on-secondary-container));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/* The fill marks the selection; the state layer stays for hover, focus and press. */
|
|
421
|
+
.mode-switch__segment.v-btn--active > .v-btn__overlay {
|
|
422
|
+
opacity: 0;
|
|
419
423
|
}
|
|
420
424
|
|
|
421
425
|
.email-confirmation-state,
|