@delmaredigital/payload-better-auth 0.3.6 → 0.3.8
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 +60 -12
- package/dist/adapter/collections.d.ts.map +1 -1
- package/dist/adapter/collections.js +126 -88
- package/dist/adapter/collections.js.map +1 -1
- package/dist/adapter/index.js +197 -150
- package/dist/adapter/index.js.map +1 -1
- package/dist/components/BeforeLogin.d.ts +1 -1
- package/dist/components/BeforeLogin.d.ts.map +1 -1
- package/dist/components/BeforeLogin.js +15 -7
- package/dist/components/BeforeLogin.js.map +1 -1
- package/dist/components/LoginView.d.ts +2 -2
- package/dist/components/LoginView.d.ts.map +1 -1
- package/dist/components/LoginView.js +660 -218
- package/dist/components/LoginView.js.map +1 -1
- package/dist/components/LoginViewWrapper.d.ts +1 -1
- package/dist/components/LoginViewWrapper.d.ts.map +1 -1
- package/dist/components/LoginViewWrapper.js +14 -4
- package/dist/components/LoginViewWrapper.js.map +1 -1
- package/dist/components/LogoutButton.d.ts +1 -1
- package/dist/components/LogoutButton.d.ts.map +1 -1
- package/dist/components/LogoutButton.js +19 -11
- package/dist/components/LogoutButton.js.map +1 -1
- package/dist/components/PasskeyRegisterButton.d.ts +2 -2
- package/dist/components/PasskeyRegisterButton.d.ts.map +1 -1
- package/dist/components/PasskeyRegisterButton.js +20 -16
- package/dist/components/PasskeyRegisterButton.js.map +1 -1
- package/dist/components/PasskeySignInButton.d.ts +2 -2
- package/dist/components/PasskeySignInButton.d.ts.map +1 -1
- package/dist/components/PasskeySignInButton.js +14 -12
- package/dist/components/PasskeySignInButton.js.map +1 -1
- package/dist/components/auth/ForgotPasswordView.d.ts +1 -1
- package/dist/components/auth/ForgotPasswordView.d.ts.map +1 -1
- package/dist/components/auth/ForgotPasswordView.js +133 -43
- package/dist/components/auth/ForgotPasswordView.js.map +1 -1
- package/dist/components/auth/ResetPasswordView.d.ts +1 -1
- package/dist/components/auth/ResetPasswordView.d.ts.map +1 -1
- package/dist/components/auth/ResetPasswordView.js +154 -50
- package/dist/components/auth/ResetPasswordView.js.map +1 -1
- package/dist/components/auth/index.js +2 -2
- package/dist/components/auth/index.js.map +1 -1
- package/dist/components/management/ApiKeysManagementClient.d.ts +2 -2
- package/dist/components/management/ApiKeysManagementClient.d.ts.map +1 -1
- package/dist/components/management/ApiKeysManagementClient.js +539 -222
- package/dist/components/management/ApiKeysManagementClient.js.map +1 -1
- package/dist/components/management/PasskeysManagementClient.d.ts +2 -2
- package/dist/components/management/PasskeysManagementClient.d.ts.map +1 -1
- package/dist/components/management/PasskeysManagementClient.js +215 -92
- package/dist/components/management/PasskeysManagementClient.js.map +1 -1
- package/dist/components/management/SecurityNavLinks.d.ts +1 -1
- package/dist/components/management/SecurityNavLinks.d.ts.map +1 -1
- package/dist/components/management/SecurityNavLinks.js +51 -24
- package/dist/components/management/SecurityNavLinks.js.map +1 -1
- package/dist/components/management/TwoFactorManagementClient.d.ts +2 -2
- package/dist/components/management/TwoFactorManagementClient.d.ts.map +1 -1
- package/dist/components/management/TwoFactorManagementClient.js +270 -111
- package/dist/components/management/TwoFactorManagementClient.js.map +1 -1
- package/dist/components/management/index.js +2 -2
- package/dist/components/management/index.js.map +1 -1
- package/dist/components/management/views/ApiKeysView.d.ts +1 -1
- package/dist/components/management/views/ApiKeysView.d.ts.map +1 -1
- package/dist/components/management/views/ApiKeysView.js +19 -4
- package/dist/components/management/views/ApiKeysView.js.map +1 -1
- package/dist/components/management/views/PasskeysView.d.ts +1 -1
- package/dist/components/management/views/PasskeysView.d.ts.map +1 -1
- package/dist/components/management/views/PasskeysView.js +16 -4
- package/dist/components/management/views/PasskeysView.js.map +1 -1
- package/dist/components/management/views/TwoFactorView.d.ts +1 -1
- package/dist/components/management/views/TwoFactorView.d.ts.map +1 -1
- package/dist/components/management/views/TwoFactorView.js +16 -4
- package/dist/components/management/views/TwoFactorView.js.map +1 -1
- package/dist/components/management/views/index.js +2 -2
- package/dist/components/management/views/index.js.map +1 -1
- package/dist/components/twoFactor/TwoFactorSetupView.d.ts +1 -1
- package/dist/components/twoFactor/TwoFactorSetupView.d.ts.map +1 -1
- package/dist/components/twoFactor/TwoFactorSetupView.js +240 -87
- package/dist/components/twoFactor/TwoFactorSetupView.js.map +1 -1
- package/dist/components/twoFactor/TwoFactorVerifyView.d.ts +1 -1
- package/dist/components/twoFactor/TwoFactorVerifyView.d.ts.map +1 -1
- package/dist/components/twoFactor/TwoFactorVerifyView.js +108 -45
- package/dist/components/twoFactor/TwoFactorVerifyView.js.map +1 -1
- package/dist/components/twoFactor/index.js +2 -2
- package/dist/components/twoFactor/index.js.map +1 -1
- package/dist/exports/client.d.ts +2356 -2
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +48 -8
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/components.js +2 -2
- package/dist/exports/components.js.map +1 -1
- package/dist/exports/management.js +3 -3
- package/dist/exports/management.js.map +1 -1
- package/dist/exports/rsc.js +2 -2
- package/dist/exports/rsc.js.map +1 -1
- package/dist/generated-types.js +4 -2
- package/dist/generated-types.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.d.ts +35 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +198 -162
- package/dist/plugin/index.js.map +1 -1
- package/dist/scripts/generate-types.js +66 -50
- package/dist/scripts/generate-types.js.map +1 -1
- package/dist/types/apiKey.js +7 -2
- package/dist/types/apiKey.js.map +1 -1
- package/dist/types/betterAuth.js +23 -2
- package/dist/types/betterAuth.js.map +1 -1
- package/dist/utils/access.js +78 -81
- package/dist/utils/access.js.map +1 -1
- package/dist/utils/apiKeyAccess.js +65 -72
- package/dist/utils/apiKeyAccess.js.map +1 -1
- package/dist/utils/betterAuthDefaults.js +8 -8
- package/dist/utils/betterAuthDefaults.js.map +1 -1
- package/dist/utils/detectAuthConfig.js +8 -11
- package/dist/utils/detectAuthConfig.js.map +1 -1
- package/dist/utils/detectEnabledPlugins.js +6 -7
- package/dist/utils/detectEnabledPlugins.js.map +1 -1
- package/dist/utils/firstUserAdmin.js +18 -20
- package/dist/utils/firstUserAdmin.js.map +1 -1
- package/dist/utils/generateScopes.js +40 -41
- package/dist/utils/generateScopes.js.map +1 -1
- package/dist/utils/session.js +8 -9
- package/dist/utils/session.js.map +1 -1
- package/package.json +97 -26
- package/src/adapter/collections.ts +621 -0
- package/src/adapter/index.ts +712 -0
- package/src/components/BeforeLogin.tsx +39 -0
- package/src/components/LoginView.tsx +1516 -0
- package/src/components/LoginViewWrapper.tsx +35 -0
- package/src/components/LogoutButton.tsx +58 -0
- package/src/components/PasskeyRegisterButton.tsx +105 -0
- package/src/components/PasskeySignInButton.tsx +96 -0
- package/src/components/auth/ForgotPasswordView.tsx +274 -0
- package/src/components/auth/ResetPasswordView.tsx +331 -0
- package/src/components/auth/index.ts +8 -0
- package/src/components/management/ApiKeysManagementClient.tsx +988 -0
- package/src/components/management/PasskeysManagementClient.tsx +409 -0
- package/src/components/management/SecurityNavLinks.tsx +117 -0
- package/src/components/management/TwoFactorManagementClient.tsx +560 -0
- package/src/components/management/index.ts +20 -0
- package/src/components/management/views/ApiKeysView.tsx +57 -0
- package/src/components/management/views/PasskeysView.tsx +42 -0
- package/src/components/management/views/TwoFactorView.tsx +42 -0
- package/src/components/management/views/index.ts +10 -0
- package/src/components/twoFactor/TwoFactorSetupView.tsx +515 -0
- package/src/components/twoFactor/TwoFactorVerifyView.tsx +238 -0
- package/src/components/twoFactor/index.ts +8 -0
- package/src/exports/client.ts +77 -0
- package/src/exports/components.ts +30 -0
- package/src/exports/management.ts +25 -0
- package/src/exports/rsc.ts +11 -0
- package/src/generated-types.ts +269 -0
- package/src/index.ts +135 -0
- package/src/plugin/index.ts +834 -0
- package/src/scripts/generate-types.ts +269 -0
- package/src/types/apiKey.ts +63 -0
- package/src/types/betterAuth.ts +253 -0
- package/src/utils/access.ts +410 -0
- package/src/utils/apiKeyAccess.ts +443 -0
- package/src/utils/betterAuthDefaults.ts +102 -0
- package/src/utils/detectAuthConfig.ts +47 -0
- package/src/utils/detectEnabledPlugins.ts +69 -0
- package/src/utils/firstUserAdmin.ts +164 -0
- package/src/utils/generateScopes.ts +150 -0
- package/src/utils/session.ts +91 -0
|
@@ -2,25 +2,24 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { useRouter } from 'next/navigation.js';
|
|
5
|
-
import { createPayloadAuthClient
|
|
5
|
+
import { createPayloadAuthClient } from '../exports/client.js';
|
|
6
6
|
import { hasAnyRole, hasAllRoles } from '../utils/access.js';
|
|
7
7
|
/**
|
|
8
8
|
* Check if user has the required role(s)
|
|
9
|
-
*/
|
|
10
|
-
function checkUserRoles(user, requiredRole, requireAllRoles) {
|
|
9
|
+
*/ function checkUserRoles(user, requiredRole, requireAllRoles) {
|
|
11
10
|
// No role requirement = access granted
|
|
12
|
-
if (!requiredRole)
|
|
13
|
-
return true;
|
|
11
|
+
if (!requiredRole) return true;
|
|
14
12
|
// No user = access denied
|
|
15
|
-
if (!user)
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (!user) return false;
|
|
14
|
+
const roles = Array.isArray(requiredRole) ? requiredRole : [
|
|
15
|
+
requiredRole
|
|
16
|
+
];
|
|
18
17
|
if (requireAllRoles) {
|
|
19
18
|
return hasAllRoles(user, roles);
|
|
20
19
|
}
|
|
21
20
|
return hasAnyRole(user, roles);
|
|
22
21
|
}
|
|
23
|
-
export function LoginView({ authClient: providedClient, logo, title = 'Login', afterLoginPath = '/admin', requiredRole = 'admin', requireAllRoles = false, enablePasskey = 'auto', enableSignUp = 'auto', defaultSignUpRole = 'user', enableForgotPassword = 'auto', resetPasswordUrl
|
|
22
|
+
export function LoginView({ authClient: providedClient, logo, title = 'Login', afterLoginPath = '/admin', requiredRole = 'admin', requireAllRoles = false, enablePasskey = 'auto', enableSignUp = 'auto', defaultSignUpRole = 'user', enableForgotPassword = 'auto', resetPasswordUrl }) {
|
|
24
23
|
const router = useRouter();
|
|
25
24
|
// View state
|
|
26
25
|
const [viewMode, setViewMode] = useState('login');
|
|
@@ -43,9 +42,9 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
43
42
|
// Two-factor authentication state
|
|
44
43
|
const [totpCode, setTotpCode] = useState('');
|
|
45
44
|
const [totpLoading, setTotpLoading] = useState(false);
|
|
46
|
-
const getClient = ()
|
|
45
|
+
const getClient = ()=>providedClient ?? createPayloadAuthClient();
|
|
47
46
|
// Check if user is already logged in on mount
|
|
48
|
-
useEffect(()
|
|
47
|
+
useEffect(()=>{
|
|
49
48
|
async function checkSession() {
|
|
50
49
|
try {
|
|
51
50
|
const client = getClient();
|
|
@@ -56,84 +55,84 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
56
55
|
if (checkUserRoles(user, requiredRole, requireAllRoles)) {
|
|
57
56
|
router.push(afterLoginPath);
|
|
58
57
|
return;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
58
|
+
} else {
|
|
61
59
|
setAccessDenied(true);
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// No session, show login form
|
|
62
|
+
} catch {
|
|
63
|
+
// No session, show login form
|
|
67
64
|
}
|
|
68
65
|
setCheckingSession(false);
|
|
69
66
|
}
|
|
70
67
|
checkSession();
|
|
71
|
-
|
|
72
|
-
}, [
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [
|
|
70
|
+
afterLoginPath,
|
|
71
|
+
requiredRole,
|
|
72
|
+
requireAllRoles,
|
|
73
|
+
router
|
|
74
|
+
]);
|
|
73
75
|
// Auto-detect passkey availability if set to 'auto'
|
|
74
|
-
useEffect(()
|
|
76
|
+
useEffect(()=>{
|
|
75
77
|
if (enablePasskey === 'auto') {
|
|
76
78
|
// Check if passkey endpoint exists (GET request)
|
|
77
79
|
// Better Auth passkey routes are at /passkey/* (singular)
|
|
78
80
|
fetch('/api/auth/passkey/generate-authenticate-options', {
|
|
79
81
|
method: 'GET',
|
|
80
|
-
credentials: 'include'
|
|
81
|
-
})
|
|
82
|
-
.then((res) => {
|
|
82
|
+
credentials: 'include'
|
|
83
|
+
}).then((res)=>{
|
|
83
84
|
// If we get a response (even 400/401 for not authenticated), passkey is available
|
|
84
85
|
// 404 means passkey plugin is not installed
|
|
85
86
|
setPasskeyAvailable(res.status !== 404);
|
|
86
|
-
})
|
|
87
|
-
.catch(() => {
|
|
87
|
+
}).catch(()=>{
|
|
88
88
|
setPasskeyAvailable(false);
|
|
89
89
|
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
90
|
+
} else {
|
|
92
91
|
setPasskeyAvailable(enablePasskey === true);
|
|
93
92
|
}
|
|
94
|
-
}, [
|
|
93
|
+
}, [
|
|
94
|
+
enablePasskey
|
|
95
|
+
]);
|
|
95
96
|
// Auto-detect sign up availability if set to 'auto'
|
|
96
|
-
useEffect(()
|
|
97
|
+
useEffect(()=>{
|
|
97
98
|
if (enableSignUp === 'auto') {
|
|
98
99
|
// Check if sign-up endpoint exists
|
|
99
100
|
fetch('/api/auth/sign-up/email', {
|
|
100
101
|
method: 'OPTIONS',
|
|
101
|
-
credentials: 'include'
|
|
102
|
-
})
|
|
103
|
-
.then((res) => {
|
|
102
|
+
credentials: 'include'
|
|
103
|
+
}).then((res)=>{
|
|
104
104
|
// 404 means sign-up is not available
|
|
105
105
|
setSignUpAvailable(res.status !== 404);
|
|
106
|
-
})
|
|
107
|
-
.catch(() => {
|
|
106
|
+
}).catch(()=>{
|
|
108
107
|
// If OPTIONS fails, try a HEAD or just assume it's available since it's a core endpoint
|
|
109
108
|
setSignUpAvailable(true);
|
|
110
109
|
});
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
110
|
+
} else {
|
|
113
111
|
setSignUpAvailable(enableSignUp === true);
|
|
114
112
|
}
|
|
115
|
-
}, [
|
|
113
|
+
}, [
|
|
114
|
+
enableSignUp
|
|
115
|
+
]);
|
|
116
116
|
// Auto-detect forgot password availability if set to 'auto'
|
|
117
|
-
useEffect(()
|
|
117
|
+
useEffect(()=>{
|
|
118
118
|
if (enableForgotPassword === 'auto') {
|
|
119
119
|
// Check if request-password-reset endpoint exists
|
|
120
120
|
fetch('/api/auth/request-password-reset', {
|
|
121
121
|
method: 'OPTIONS',
|
|
122
|
-
credentials: 'include'
|
|
123
|
-
})
|
|
124
|
-
.then((res) => {
|
|
122
|
+
credentials: 'include'
|
|
123
|
+
}).then((res)=>{
|
|
125
124
|
// 404 means request-password-reset is not available
|
|
126
125
|
setForgotPasswordAvailable(res.status !== 404);
|
|
127
|
-
})
|
|
128
|
-
.catch(() => {
|
|
126
|
+
}).catch(()=>{
|
|
129
127
|
// If OPTIONS fails, assume it's available since it's a core endpoint
|
|
130
128
|
setForgotPasswordAvailable(true);
|
|
131
129
|
});
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
130
|
+
} else {
|
|
134
131
|
setForgotPasswordAvailable(enableForgotPassword === true);
|
|
135
132
|
}
|
|
136
|
-
}, [
|
|
133
|
+
}, [
|
|
134
|
+
enableForgotPassword
|
|
135
|
+
]);
|
|
137
136
|
async function handleSubmit(e) {
|
|
138
137
|
e.preventDefault();
|
|
139
138
|
setLoading(true);
|
|
@@ -144,7 +143,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
144
143
|
const client = getClient();
|
|
145
144
|
const result = await client.signIn.email({
|
|
146
145
|
email,
|
|
147
|
-
password
|
|
146
|
+
password
|
|
148
147
|
});
|
|
149
148
|
// Check if 2FA is required (use 'in' operator for proper TypeScript inference)
|
|
150
149
|
if (result.data && 'twoFactorRedirect' in result.data && result.data.twoFactorRedirect) {
|
|
@@ -168,8 +167,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
168
167
|
router.push(afterLoginPath);
|
|
169
168
|
router.refresh();
|
|
170
169
|
}
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
170
|
+
} catch {
|
|
173
171
|
setError('An error occurred. Please try again.');
|
|
174
172
|
setLoading(false);
|
|
175
173
|
}
|
|
@@ -197,7 +195,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
197
195
|
email,
|
|
198
196
|
password,
|
|
199
197
|
name,
|
|
200
|
-
role: defaultSignUpRole
|
|
198
|
+
role: defaultSignUpRole
|
|
201
199
|
});
|
|
202
200
|
if (result.error) {
|
|
203
201
|
setError(result.error.message ?? 'Registration failed');
|
|
@@ -220,8 +218,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
220
218
|
}
|
|
221
219
|
router.push(afterLoginPath);
|
|
222
220
|
router.refresh();
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
221
|
+
} else {
|
|
225
222
|
// Likely requires email verification - show success and switch to login
|
|
226
223
|
setSuccessMessage('Account created! Please check your email to verify your account.');
|
|
227
224
|
setViewMode('login');
|
|
@@ -229,8 +226,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
229
226
|
setConfirmPassword('');
|
|
230
227
|
setLoading(false);
|
|
231
228
|
}
|
|
232
|
-
}
|
|
233
|
-
catch {
|
|
229
|
+
} catch {
|
|
234
230
|
setError('An error occurred. Please try again.');
|
|
235
231
|
setLoading(false);
|
|
236
232
|
}
|
|
@@ -244,7 +240,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
244
240
|
const client = getClient();
|
|
245
241
|
const result = await client.requestPasswordReset({
|
|
246
242
|
email,
|
|
247
|
-
redirectTo: resetPasswordUrl ?? `${window.location.origin}/admin/reset-password
|
|
243
|
+
redirectTo: resetPasswordUrl ?? `${window.location.origin}/admin/reset-password`
|
|
248
244
|
});
|
|
249
245
|
if (result.error) {
|
|
250
246
|
setError(result.error.message ?? 'Failed to send reset email');
|
|
@@ -254,8 +250,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
254
250
|
// Success - show confirmation
|
|
255
251
|
setViewMode('resetSent');
|
|
256
252
|
setLoading(false);
|
|
257
|
-
}
|
|
258
|
-
catch {
|
|
253
|
+
} catch {
|
|
259
254
|
setError('An error occurred. Please try again.');
|
|
260
255
|
setLoading(false);
|
|
261
256
|
}
|
|
@@ -266,7 +261,9 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
266
261
|
setError(null);
|
|
267
262
|
try {
|
|
268
263
|
const client = getClient();
|
|
269
|
-
const result = await client.twoFactor.verifyTotp({
|
|
264
|
+
const result = await client.twoFactor.verifyTotp({
|
|
265
|
+
code: totpCode
|
|
266
|
+
});
|
|
270
267
|
if (result.error) {
|
|
271
268
|
setError(result.error.message ?? 'Invalid verification code');
|
|
272
269
|
setTotpLoading(false);
|
|
@@ -287,8 +284,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
287
284
|
}
|
|
288
285
|
router.push(afterLoginPath);
|
|
289
286
|
router.refresh();
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
287
|
+
} catch {
|
|
292
288
|
setError('An error occurred. Please try again.');
|
|
293
289
|
setTotpLoading(false);
|
|
294
290
|
}
|
|
@@ -301,12 +297,10 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
301
297
|
if (newView === 'login') {
|
|
302
298
|
setTotpCode('');
|
|
303
299
|
setConfirmPassword('');
|
|
304
|
-
}
|
|
305
|
-
else if (newView === 'register') {
|
|
300
|
+
} else if (newView === 'register') {
|
|
306
301
|
setPassword('');
|
|
307
302
|
setConfirmPassword('');
|
|
308
|
-
}
|
|
309
|
-
else if (newView === 'forgotPassword') {
|
|
303
|
+
} else if (newView === 'forgotPassword') {
|
|
310
304
|
setPassword('');
|
|
311
305
|
}
|
|
312
306
|
}
|
|
@@ -314,8 +308,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
314
308
|
switchView('login');
|
|
315
309
|
}
|
|
316
310
|
async function handlePasskeySignIn() {
|
|
317
|
-
if (!passkeyAvailable)
|
|
318
|
-
return;
|
|
311
|
+
if (!passkeyAvailable) return;
|
|
319
312
|
setPasskeyLoading(true);
|
|
320
313
|
setError(null);
|
|
321
314
|
setAccessDenied(false);
|
|
@@ -340,18 +333,15 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
340
333
|
}
|
|
341
334
|
router.push(afterLoginPath);
|
|
342
335
|
router.refresh();
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
336
|
+
} else {
|
|
345
337
|
// Session fetch failed - shouldn't happen after successful passkey auth
|
|
346
338
|
setError('Authentication succeeded but session could not be verified');
|
|
347
339
|
setPasskeyLoading(false);
|
|
348
340
|
}
|
|
349
|
-
}
|
|
350
|
-
catch (err) {
|
|
341
|
+
} catch (err) {
|
|
351
342
|
if (err instanceof Error && err.name === 'NotAllowedError') {
|
|
352
343
|
setError('Passkey authentication was cancelled or not allowed');
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
344
|
+
} else {
|
|
355
345
|
setError(err instanceof Error ? err.message : 'Passkey authentication failed');
|
|
356
346
|
}
|
|
357
347
|
setPasskeyLoading(false);
|
|
@@ -365,89 +355,158 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
365
355
|
}
|
|
366
356
|
// Loading state while checking session
|
|
367
357
|
if (checkingSession) {
|
|
368
|
-
return
|
|
358
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
359
|
+
style: {
|
|
369
360
|
minHeight: '100vh',
|
|
370
361
|
display: 'flex',
|
|
371
362
|
alignItems: 'center',
|
|
372
363
|
justifyContent: 'center',
|
|
373
|
-
background: 'var(--theme-bg)'
|
|
374
|
-
},
|
|
364
|
+
background: 'var(--theme-bg)'
|
|
365
|
+
},
|
|
366
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
367
|
+
style: {
|
|
368
|
+
color: 'var(--theme-text)',
|
|
369
|
+
opacity: 0.7
|
|
370
|
+
},
|
|
371
|
+
children: "Loading..."
|
|
372
|
+
})
|
|
373
|
+
});
|
|
375
374
|
}
|
|
376
375
|
// Access denied state
|
|
377
376
|
if (accessDenied) {
|
|
378
|
-
return
|
|
377
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
378
|
+
style: {
|
|
379
379
|
minHeight: '100vh',
|
|
380
380
|
display: 'flex',
|
|
381
381
|
alignItems: 'center',
|
|
382
382
|
justifyContent: 'center',
|
|
383
383
|
background: 'var(--theme-bg)',
|
|
384
|
-
padding: 'var(--base)'
|
|
385
|
-
},
|
|
384
|
+
padding: 'var(--base)'
|
|
385
|
+
},
|
|
386
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
387
|
+
style: {
|
|
386
388
|
background: 'var(--theme-elevation-50)',
|
|
387
389
|
padding: 'calc(var(--base) * 2)',
|
|
388
390
|
borderRadius: 'var(--style-radius-m)',
|
|
389
391
|
boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
|
|
390
392
|
width: '100%',
|
|
391
393
|
maxWidth: '400px',
|
|
392
|
-
textAlign: 'center'
|
|
393
|
-
},
|
|
394
|
+
textAlign: 'center'
|
|
395
|
+
},
|
|
396
|
+
children: [
|
|
397
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
398
|
+
style: {
|
|
394
399
|
color: 'var(--theme-error-500)',
|
|
395
400
|
fontSize: 'var(--font-size-h3)',
|
|
396
401
|
fontWeight: 600,
|
|
397
|
-
margin: '0 0 var(--base) 0'
|
|
398
|
-
},
|
|
402
|
+
margin: '0 0 var(--base) 0'
|
|
403
|
+
},
|
|
404
|
+
children: "Access Denied"
|
|
405
|
+
}),
|
|
406
|
+
/*#__PURE__*/ _jsx("p", {
|
|
407
|
+
style: {
|
|
399
408
|
color: 'var(--theme-text)',
|
|
400
409
|
opacity: 0.8,
|
|
401
410
|
marginBottom: 'calc(var(--base) * 1.5)',
|
|
402
|
-
fontSize: 'var(--font-size-small)'
|
|
403
|
-
},
|
|
411
|
+
fontSize: 'var(--font-size-small)'
|
|
412
|
+
},
|
|
413
|
+
children: "You don't have permission to access the admin panel. Please contact an administrator if you believe this is an error."
|
|
414
|
+
}),
|
|
415
|
+
/*#__PURE__*/ _jsx("button", {
|
|
416
|
+
onClick: handleSignOut,
|
|
417
|
+
style: {
|
|
404
418
|
padding: 'calc(var(--base) * 0.75) calc(var(--base) * 1.5)',
|
|
405
419
|
background: 'var(--theme-elevation-150)',
|
|
406
420
|
border: 'none',
|
|
407
421
|
borderRadius: 'var(--style-radius-s)',
|
|
408
422
|
color: 'var(--theme-text)',
|
|
409
423
|
fontSize: 'var(--font-size-base)',
|
|
410
|
-
cursor: 'pointer'
|
|
411
|
-
},
|
|
424
|
+
cursor: 'pointer'
|
|
425
|
+
},
|
|
426
|
+
children: "Sign out and try again"
|
|
427
|
+
})
|
|
428
|
+
]
|
|
429
|
+
})
|
|
430
|
+
});
|
|
412
431
|
}
|
|
413
432
|
// Two-factor verification view
|
|
414
433
|
if (viewMode === 'twoFactor') {
|
|
415
|
-
return
|
|
434
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
435
|
+
style: {
|
|
416
436
|
minHeight: '100vh',
|
|
417
437
|
display: 'flex',
|
|
418
438
|
alignItems: 'center',
|
|
419
439
|
justifyContent: 'center',
|
|
420
440
|
background: 'var(--theme-bg)',
|
|
421
|
-
padding: 'var(--base)'
|
|
422
|
-
},
|
|
441
|
+
padding: 'var(--base)'
|
|
442
|
+
},
|
|
443
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
444
|
+
style: {
|
|
423
445
|
background: 'var(--theme-elevation-50)',
|
|
424
446
|
padding: 'calc(var(--base) * 2)',
|
|
425
447
|
borderRadius: 'var(--style-radius-m)',
|
|
426
448
|
boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
|
|
427
449
|
width: '100%',
|
|
428
|
-
maxWidth: '400px'
|
|
429
|
-
},
|
|
450
|
+
maxWidth: '400px'
|
|
451
|
+
},
|
|
452
|
+
children: [
|
|
453
|
+
logo && /*#__PURE__*/ _jsx("div", {
|
|
454
|
+
style: {
|
|
430
455
|
textAlign: 'center',
|
|
431
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
432
|
-
},
|
|
456
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
457
|
+
},
|
|
458
|
+
children: logo
|
|
459
|
+
}),
|
|
460
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
461
|
+
style: {
|
|
433
462
|
color: 'var(--theme-text)',
|
|
434
463
|
fontSize: 'var(--font-size-h3)',
|
|
435
464
|
fontWeight: 600,
|
|
436
465
|
margin: '0 0 calc(var(--base) * 0.5) 0',
|
|
437
|
-
textAlign: 'center'
|
|
438
|
-
},
|
|
466
|
+
textAlign: 'center'
|
|
467
|
+
},
|
|
468
|
+
children: "Two-Factor Authentication"
|
|
469
|
+
}),
|
|
470
|
+
/*#__PURE__*/ _jsx("p", {
|
|
471
|
+
style: {
|
|
439
472
|
color: 'var(--theme-text)',
|
|
440
473
|
opacity: 0.7,
|
|
441
474
|
fontSize: 'var(--font-size-small)',
|
|
442
475
|
textAlign: 'center',
|
|
443
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
444
|
-
},
|
|
476
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
477
|
+
},
|
|
478
|
+
children: "Enter the 6-digit code from your authenticator app"
|
|
479
|
+
}),
|
|
480
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
481
|
+
onSubmit: handleTotpVerify,
|
|
482
|
+
children: [
|
|
483
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
484
|
+
style: {
|
|
485
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
486
|
+
},
|
|
487
|
+
children: [
|
|
488
|
+
/*#__PURE__*/ _jsx("label", {
|
|
489
|
+
htmlFor: "totp-code",
|
|
490
|
+
style: {
|
|
445
491
|
display: 'block',
|
|
446
492
|
color: 'var(--theme-text)',
|
|
447
493
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
448
494
|
fontSize: 'var(--font-size-small)',
|
|
449
|
-
fontWeight: 500
|
|
450
|
-
},
|
|
495
|
+
fontWeight: 500
|
|
496
|
+
},
|
|
497
|
+
children: "Verification Code"
|
|
498
|
+
}),
|
|
499
|
+
/*#__PURE__*/ _jsx("input", {
|
|
500
|
+
id: "totp-code",
|
|
501
|
+
type: "text",
|
|
502
|
+
inputMode: "numeric",
|
|
503
|
+
pattern: "[0-9]*",
|
|
504
|
+
autoComplete: "one-time-code",
|
|
505
|
+
value: totpCode,
|
|
506
|
+
onChange: (e)=>setTotpCode(e.target.value.replace(/\D/g, '').slice(0, 6)),
|
|
507
|
+
required: true,
|
|
508
|
+
placeholder: "000000",
|
|
509
|
+
style: {
|
|
451
510
|
width: '100%',
|
|
452
511
|
padding: 'calc(var(--base) * 0.75)',
|
|
453
512
|
background: 'var(--theme-input-bg)',
|
|
@@ -459,16 +518,27 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
459
518
|
textAlign: 'center',
|
|
460
519
|
letterSpacing: '0.5em',
|
|
461
520
|
outline: 'none',
|
|
462
|
-
boxSizing: 'border-box'
|
|
463
|
-
}
|
|
521
|
+
boxSizing: 'border-box'
|
|
522
|
+
}
|
|
523
|
+
})
|
|
524
|
+
]
|
|
525
|
+
}),
|
|
526
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
527
|
+
style: {
|
|
464
528
|
color: 'var(--theme-error-500)',
|
|
465
529
|
marginBottom: 'var(--base)',
|
|
466
530
|
fontSize: 'var(--font-size-small)',
|
|
467
531
|
padding: 'calc(var(--base) * 0.5)',
|
|
468
532
|
background: 'var(--theme-error-50)',
|
|
469
533
|
borderRadius: 'var(--style-radius-s)',
|
|
470
|
-
border: '1px solid var(--theme-error-200)'
|
|
471
|
-
},
|
|
534
|
+
border: '1px solid var(--theme-error-200)'
|
|
535
|
+
},
|
|
536
|
+
children: error
|
|
537
|
+
}),
|
|
538
|
+
/*#__PURE__*/ _jsx("button", {
|
|
539
|
+
type: "submit",
|
|
540
|
+
disabled: totpLoading || totpCode.length !== 6,
|
|
541
|
+
style: {
|
|
472
542
|
width: '100%',
|
|
473
543
|
padding: 'calc(var(--base) * 0.75)',
|
|
474
544
|
background: 'var(--theme-elevation-800)',
|
|
@@ -479,8 +549,16 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
479
549
|
fontWeight: 500,
|
|
480
550
|
cursor: totpLoading || totpCode.length !== 6 ? 'not-allowed' : 'pointer',
|
|
481
551
|
opacity: totpLoading || totpCode.length !== 6 ? 0.7 : 1,
|
|
482
|
-
transition: 'opacity 150ms ease'
|
|
483
|
-
},
|
|
552
|
+
transition: 'opacity 150ms ease'
|
|
553
|
+
},
|
|
554
|
+
children: totpLoading ? 'Verifying...' : 'Verify'
|
|
555
|
+
})
|
|
556
|
+
]
|
|
557
|
+
}),
|
|
558
|
+
/*#__PURE__*/ _jsx("button", {
|
|
559
|
+
type: "button",
|
|
560
|
+
onClick: handleBackToLogin,
|
|
561
|
+
style: {
|
|
484
562
|
width: '100%',
|
|
485
563
|
marginTop: 'var(--base)',
|
|
486
564
|
padding: 'calc(var(--base) * 0.5)',
|
|
@@ -489,41 +567,79 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
489
567
|
color: 'var(--theme-text)',
|
|
490
568
|
opacity: 0.7,
|
|
491
569
|
fontSize: 'var(--font-size-small)',
|
|
492
|
-
cursor: 'pointer'
|
|
493
|
-
},
|
|
570
|
+
cursor: 'pointer'
|
|
571
|
+
},
|
|
572
|
+
children: "← Back to login"
|
|
573
|
+
})
|
|
574
|
+
]
|
|
575
|
+
})
|
|
576
|
+
});
|
|
494
577
|
}
|
|
495
578
|
// Registration view
|
|
496
579
|
if (viewMode === 'register') {
|
|
497
|
-
return
|
|
580
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
581
|
+
style: {
|
|
498
582
|
minHeight: '100vh',
|
|
499
583
|
display: 'flex',
|
|
500
584
|
alignItems: 'center',
|
|
501
585
|
justifyContent: 'center',
|
|
502
586
|
background: 'var(--theme-bg)',
|
|
503
|
-
padding: 'var(--base)'
|
|
504
|
-
},
|
|
587
|
+
padding: 'var(--base)'
|
|
588
|
+
},
|
|
589
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
590
|
+
style: {
|
|
505
591
|
background: 'var(--theme-elevation-50)',
|
|
506
592
|
padding: 'calc(var(--base) * 2)',
|
|
507
593
|
borderRadius: 'var(--style-radius-m)',
|
|
508
594
|
boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
|
|
509
595
|
width: '100%',
|
|
510
|
-
maxWidth: '400px'
|
|
511
|
-
},
|
|
596
|
+
maxWidth: '400px'
|
|
597
|
+
},
|
|
598
|
+
children: [
|
|
599
|
+
logo && /*#__PURE__*/ _jsx("div", {
|
|
600
|
+
style: {
|
|
512
601
|
textAlign: 'center',
|
|
513
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
514
|
-
},
|
|
602
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
603
|
+
},
|
|
604
|
+
children: logo
|
|
605
|
+
}),
|
|
606
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
607
|
+
style: {
|
|
515
608
|
color: 'var(--theme-text)',
|
|
516
609
|
fontSize: 'var(--font-size-h3)',
|
|
517
610
|
fontWeight: 600,
|
|
518
611
|
margin: '0 0 calc(var(--base) * 1.5) 0',
|
|
519
|
-
textAlign: 'center'
|
|
520
|
-
},
|
|
612
|
+
textAlign: 'center'
|
|
613
|
+
},
|
|
614
|
+
children: "Create Account"
|
|
615
|
+
}),
|
|
616
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
617
|
+
onSubmit: handleSignUp,
|
|
618
|
+
children: [
|
|
619
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
620
|
+
style: {
|
|
621
|
+
marginBottom: 'var(--base)'
|
|
622
|
+
},
|
|
623
|
+
children: [
|
|
624
|
+
/*#__PURE__*/ _jsx("label", {
|
|
625
|
+
htmlFor: "name",
|
|
626
|
+
style: {
|
|
521
627
|
display: 'block',
|
|
522
628
|
color: 'var(--theme-text)',
|
|
523
629
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
524
630
|
fontSize: 'var(--font-size-small)',
|
|
525
|
-
fontWeight: 500
|
|
526
|
-
},
|
|
631
|
+
fontWeight: 500
|
|
632
|
+
},
|
|
633
|
+
children: "Name"
|
|
634
|
+
}),
|
|
635
|
+
/*#__PURE__*/ _jsx("input", {
|
|
636
|
+
id: "name",
|
|
637
|
+
type: "text",
|
|
638
|
+
value: name,
|
|
639
|
+
onChange: (e)=>setName(e.target.value),
|
|
640
|
+
required: true,
|
|
641
|
+
autoComplete: "name",
|
|
642
|
+
style: {
|
|
527
643
|
width: '100%',
|
|
528
644
|
padding: 'calc(var(--base) * 0.75)',
|
|
529
645
|
background: 'var(--theme-input-bg)',
|
|
@@ -532,14 +648,35 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
532
648
|
color: 'var(--theme-text)',
|
|
533
649
|
fontSize: 'var(--font-size-base)',
|
|
534
650
|
outline: 'none',
|
|
535
|
-
boxSizing: 'border-box'
|
|
536
|
-
}
|
|
651
|
+
boxSizing: 'border-box'
|
|
652
|
+
}
|
|
653
|
+
})
|
|
654
|
+
]
|
|
655
|
+
}),
|
|
656
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
657
|
+
style: {
|
|
658
|
+
marginBottom: 'var(--base)'
|
|
659
|
+
},
|
|
660
|
+
children: [
|
|
661
|
+
/*#__PURE__*/ _jsx("label", {
|
|
662
|
+
htmlFor: "register-email",
|
|
663
|
+
style: {
|
|
537
664
|
display: 'block',
|
|
538
665
|
color: 'var(--theme-text)',
|
|
539
666
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
540
667
|
fontSize: 'var(--font-size-small)',
|
|
541
|
-
fontWeight: 500
|
|
542
|
-
},
|
|
668
|
+
fontWeight: 500
|
|
669
|
+
},
|
|
670
|
+
children: "Email"
|
|
671
|
+
}),
|
|
672
|
+
/*#__PURE__*/ _jsx("input", {
|
|
673
|
+
id: "register-email",
|
|
674
|
+
type: "email",
|
|
675
|
+
value: email,
|
|
676
|
+
onChange: (e)=>setEmail(e.target.value),
|
|
677
|
+
required: true,
|
|
678
|
+
autoComplete: "email",
|
|
679
|
+
style: {
|
|
543
680
|
width: '100%',
|
|
544
681
|
padding: 'calc(var(--base) * 0.75)',
|
|
545
682
|
background: 'var(--theme-input-bg)',
|
|
@@ -548,14 +685,35 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
548
685
|
color: 'var(--theme-text)',
|
|
549
686
|
fontSize: 'var(--font-size-base)',
|
|
550
687
|
outline: 'none',
|
|
551
|
-
boxSizing: 'border-box'
|
|
552
|
-
}
|
|
688
|
+
boxSizing: 'border-box'
|
|
689
|
+
}
|
|
690
|
+
})
|
|
691
|
+
]
|
|
692
|
+
}),
|
|
693
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
694
|
+
style: {
|
|
695
|
+
marginBottom: 'var(--base)'
|
|
696
|
+
},
|
|
697
|
+
children: [
|
|
698
|
+
/*#__PURE__*/ _jsx("label", {
|
|
699
|
+
htmlFor: "register-password",
|
|
700
|
+
style: {
|
|
553
701
|
display: 'block',
|
|
554
702
|
color: 'var(--theme-text)',
|
|
555
703
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
556
704
|
fontSize: 'var(--font-size-small)',
|
|
557
|
-
fontWeight: 500
|
|
558
|
-
},
|
|
705
|
+
fontWeight: 500
|
|
706
|
+
},
|
|
707
|
+
children: "Password"
|
|
708
|
+
}),
|
|
709
|
+
/*#__PURE__*/ _jsx("input", {
|
|
710
|
+
id: "register-password",
|
|
711
|
+
type: "password",
|
|
712
|
+
value: password,
|
|
713
|
+
onChange: (e)=>setPassword(e.target.value),
|
|
714
|
+
required: true,
|
|
715
|
+
autoComplete: "new-password",
|
|
716
|
+
style: {
|
|
559
717
|
width: '100%',
|
|
560
718
|
padding: 'calc(var(--base) * 0.75)',
|
|
561
719
|
background: 'var(--theme-input-bg)',
|
|
@@ -564,14 +722,35 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
564
722
|
color: 'var(--theme-text)',
|
|
565
723
|
fontSize: 'var(--font-size-base)',
|
|
566
724
|
outline: 'none',
|
|
567
|
-
boxSizing: 'border-box'
|
|
568
|
-
}
|
|
725
|
+
boxSizing: 'border-box'
|
|
726
|
+
}
|
|
727
|
+
})
|
|
728
|
+
]
|
|
729
|
+
}),
|
|
730
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
731
|
+
style: {
|
|
732
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
733
|
+
},
|
|
734
|
+
children: [
|
|
735
|
+
/*#__PURE__*/ _jsx("label", {
|
|
736
|
+
htmlFor: "confirm-password",
|
|
737
|
+
style: {
|
|
569
738
|
display: 'block',
|
|
570
739
|
color: 'var(--theme-text)',
|
|
571
740
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
572
741
|
fontSize: 'var(--font-size-small)',
|
|
573
|
-
fontWeight: 500
|
|
574
|
-
},
|
|
742
|
+
fontWeight: 500
|
|
743
|
+
},
|
|
744
|
+
children: "Confirm Password"
|
|
745
|
+
}),
|
|
746
|
+
/*#__PURE__*/ _jsx("input", {
|
|
747
|
+
id: "confirm-password",
|
|
748
|
+
type: "password",
|
|
749
|
+
value: confirmPassword,
|
|
750
|
+
onChange: (e)=>setConfirmPassword(e.target.value),
|
|
751
|
+
required: true,
|
|
752
|
+
autoComplete: "new-password",
|
|
753
|
+
style: {
|
|
575
754
|
width: '100%',
|
|
576
755
|
padding: 'calc(var(--base) * 0.75)',
|
|
577
756
|
background: 'var(--theme-input-bg)',
|
|
@@ -580,16 +759,27 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
580
759
|
color: 'var(--theme-text)',
|
|
581
760
|
fontSize: 'var(--font-size-base)',
|
|
582
761
|
outline: 'none',
|
|
583
|
-
boxSizing: 'border-box'
|
|
584
|
-
}
|
|
762
|
+
boxSizing: 'border-box'
|
|
763
|
+
}
|
|
764
|
+
})
|
|
765
|
+
]
|
|
766
|
+
}),
|
|
767
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
768
|
+
style: {
|
|
585
769
|
color: 'var(--theme-error-500)',
|
|
586
770
|
marginBottom: 'var(--base)',
|
|
587
771
|
fontSize: 'var(--font-size-small)',
|
|
588
772
|
padding: 'calc(var(--base) * 0.5)',
|
|
589
773
|
background: 'var(--theme-error-50)',
|
|
590
774
|
borderRadius: 'var(--style-radius-s)',
|
|
591
|
-
border: '1px solid var(--theme-error-200)'
|
|
592
|
-
},
|
|
775
|
+
border: '1px solid var(--theme-error-200)'
|
|
776
|
+
},
|
|
777
|
+
children: error
|
|
778
|
+
}),
|
|
779
|
+
/*#__PURE__*/ _jsx("button", {
|
|
780
|
+
type: "submit",
|
|
781
|
+
disabled: loading,
|
|
782
|
+
style: {
|
|
593
783
|
width: '100%',
|
|
594
784
|
padding: 'calc(var(--base) * 0.75)',
|
|
595
785
|
background: 'var(--theme-elevation-800)',
|
|
@@ -600,61 +790,118 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
600
790
|
fontWeight: 500,
|
|
601
791
|
cursor: loading ? 'not-allowed' : 'pointer',
|
|
602
792
|
opacity: loading ? 0.7 : 1,
|
|
603
|
-
transition: 'opacity 150ms ease'
|
|
604
|
-
},
|
|
793
|
+
transition: 'opacity 150ms ease'
|
|
794
|
+
},
|
|
795
|
+
children: loading ? 'Creating account...' : 'Create Account'
|
|
796
|
+
})
|
|
797
|
+
]
|
|
798
|
+
}),
|
|
799
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
800
|
+
style: {
|
|
605
801
|
marginTop: 'calc(var(--base) * 1.5)',
|
|
606
802
|
textAlign: 'center',
|
|
607
803
|
fontSize: 'var(--font-size-small)',
|
|
608
804
|
color: 'var(--theme-text)',
|
|
609
|
-
opacity: 0.8
|
|
610
|
-
},
|
|
805
|
+
opacity: 0.8
|
|
806
|
+
},
|
|
807
|
+
children: [
|
|
808
|
+
"Already have an account?",
|
|
809
|
+
' ',
|
|
810
|
+
/*#__PURE__*/ _jsx("button", {
|
|
811
|
+
type: "button",
|
|
812
|
+
onClick: handleBackToLogin,
|
|
813
|
+
style: {
|
|
611
814
|
background: 'none',
|
|
612
815
|
border: 'none',
|
|
613
816
|
color: 'var(--theme-elevation-800)',
|
|
614
817
|
cursor: 'pointer',
|
|
615
818
|
fontSize: 'inherit',
|
|
616
819
|
textDecoration: 'underline',
|
|
617
|
-
padding: 0
|
|
618
|
-
},
|
|
820
|
+
padding: 0
|
|
821
|
+
},
|
|
822
|
+
children: "Sign in"
|
|
823
|
+
})
|
|
824
|
+
]
|
|
825
|
+
})
|
|
826
|
+
]
|
|
827
|
+
})
|
|
828
|
+
});
|
|
619
829
|
}
|
|
620
830
|
// Forgot password view
|
|
621
831
|
if (viewMode === 'forgotPassword') {
|
|
622
|
-
return
|
|
832
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
833
|
+
style: {
|
|
623
834
|
minHeight: '100vh',
|
|
624
835
|
display: 'flex',
|
|
625
836
|
alignItems: 'center',
|
|
626
837
|
justifyContent: 'center',
|
|
627
838
|
background: 'var(--theme-bg)',
|
|
628
|
-
padding: 'var(--base)'
|
|
629
|
-
},
|
|
839
|
+
padding: 'var(--base)'
|
|
840
|
+
},
|
|
841
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
842
|
+
style: {
|
|
630
843
|
background: 'var(--theme-elevation-50)',
|
|
631
844
|
padding: 'calc(var(--base) * 2)',
|
|
632
845
|
borderRadius: 'var(--style-radius-m)',
|
|
633
846
|
boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
|
|
634
847
|
width: '100%',
|
|
635
|
-
maxWidth: '400px'
|
|
636
|
-
},
|
|
848
|
+
maxWidth: '400px'
|
|
849
|
+
},
|
|
850
|
+
children: [
|
|
851
|
+
logo && /*#__PURE__*/ _jsx("div", {
|
|
852
|
+
style: {
|
|
637
853
|
textAlign: 'center',
|
|
638
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
639
|
-
},
|
|
854
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
855
|
+
},
|
|
856
|
+
children: logo
|
|
857
|
+
}),
|
|
858
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
859
|
+
style: {
|
|
640
860
|
color: 'var(--theme-text)',
|
|
641
861
|
fontSize: 'var(--font-size-h3)',
|
|
642
862
|
fontWeight: 600,
|
|
643
863
|
margin: '0 0 calc(var(--base) * 0.5) 0',
|
|
644
|
-
textAlign: 'center'
|
|
645
|
-
},
|
|
864
|
+
textAlign: 'center'
|
|
865
|
+
},
|
|
866
|
+
children: "Reset Password"
|
|
867
|
+
}),
|
|
868
|
+
/*#__PURE__*/ _jsx("p", {
|
|
869
|
+
style: {
|
|
646
870
|
color: 'var(--theme-text)',
|
|
647
871
|
opacity: 0.7,
|
|
648
872
|
fontSize: 'var(--font-size-small)',
|
|
649
873
|
textAlign: 'center',
|
|
650
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
651
|
-
},
|
|
874
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
875
|
+
},
|
|
876
|
+
children: "Enter your email and we'll send you a link to reset your password"
|
|
877
|
+
}),
|
|
878
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
879
|
+
onSubmit: handleForgotPassword,
|
|
880
|
+
children: [
|
|
881
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
882
|
+
style: {
|
|
883
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
884
|
+
},
|
|
885
|
+
children: [
|
|
886
|
+
/*#__PURE__*/ _jsx("label", {
|
|
887
|
+
htmlFor: "forgot-email",
|
|
888
|
+
style: {
|
|
652
889
|
display: 'block',
|
|
653
890
|
color: 'var(--theme-text)',
|
|
654
891
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
655
892
|
fontSize: 'var(--font-size-small)',
|
|
656
|
-
fontWeight: 500
|
|
657
|
-
},
|
|
893
|
+
fontWeight: 500
|
|
894
|
+
},
|
|
895
|
+
children: "Email"
|
|
896
|
+
}),
|
|
897
|
+
/*#__PURE__*/ _jsx("input", {
|
|
898
|
+
id: "forgot-email",
|
|
899
|
+
type: "email",
|
|
900
|
+
value: email,
|
|
901
|
+
onChange: (e)=>setEmail(e.target.value),
|
|
902
|
+
required: true,
|
|
903
|
+
autoComplete: "email",
|
|
904
|
+
style: {
|
|
658
905
|
width: '100%',
|
|
659
906
|
padding: 'calc(var(--base) * 0.75)',
|
|
660
907
|
background: 'var(--theme-input-bg)',
|
|
@@ -663,16 +910,27 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
663
910
|
color: 'var(--theme-text)',
|
|
664
911
|
fontSize: 'var(--font-size-base)',
|
|
665
912
|
outline: 'none',
|
|
666
|
-
boxSizing: 'border-box'
|
|
667
|
-
}
|
|
913
|
+
boxSizing: 'border-box'
|
|
914
|
+
}
|
|
915
|
+
})
|
|
916
|
+
]
|
|
917
|
+
}),
|
|
918
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
919
|
+
style: {
|
|
668
920
|
color: 'var(--theme-error-500)',
|
|
669
921
|
marginBottom: 'var(--base)',
|
|
670
922
|
fontSize: 'var(--font-size-small)',
|
|
671
923
|
padding: 'calc(var(--base) * 0.5)',
|
|
672
924
|
background: 'var(--theme-error-50)',
|
|
673
925
|
borderRadius: 'var(--style-radius-s)',
|
|
674
|
-
border: '1px solid var(--theme-error-200)'
|
|
675
|
-
},
|
|
926
|
+
border: '1px solid var(--theme-error-200)'
|
|
927
|
+
},
|
|
928
|
+
children: error
|
|
929
|
+
}),
|
|
930
|
+
/*#__PURE__*/ _jsx("button", {
|
|
931
|
+
type: "submit",
|
|
932
|
+
disabled: loading,
|
|
933
|
+
style: {
|
|
676
934
|
width: '100%',
|
|
677
935
|
padding: 'calc(var(--base) * 0.75)',
|
|
678
936
|
background: 'var(--theme-elevation-800)',
|
|
@@ -683,8 +941,16 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
683
941
|
fontWeight: 500,
|
|
684
942
|
cursor: loading ? 'not-allowed' : 'pointer',
|
|
685
943
|
opacity: loading ? 0.7 : 1,
|
|
686
|
-
transition: 'opacity 150ms ease'
|
|
687
|
-
},
|
|
944
|
+
transition: 'opacity 150ms ease'
|
|
945
|
+
},
|
|
946
|
+
children: loading ? 'Sending...' : 'Send Reset Link'
|
|
947
|
+
})
|
|
948
|
+
]
|
|
949
|
+
}),
|
|
950
|
+
/*#__PURE__*/ _jsx("button", {
|
|
951
|
+
type: "button",
|
|
952
|
+
onClick: handleBackToLogin,
|
|
953
|
+
style: {
|
|
688
954
|
width: '100%',
|
|
689
955
|
marginTop: 'var(--base)',
|
|
690
956
|
padding: 'calc(var(--base) * 0.5)',
|
|
@@ -693,29 +959,44 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
693
959
|
color: 'var(--theme-text)',
|
|
694
960
|
opacity: 0.7,
|
|
695
961
|
fontSize: 'var(--font-size-small)',
|
|
696
|
-
cursor: 'pointer'
|
|
697
|
-
},
|
|
962
|
+
cursor: 'pointer'
|
|
963
|
+
},
|
|
964
|
+
children: "← Back to login"
|
|
965
|
+
})
|
|
966
|
+
]
|
|
967
|
+
})
|
|
968
|
+
});
|
|
698
969
|
}
|
|
699
970
|
// Reset link sent confirmation view
|
|
700
971
|
if (viewMode === 'resetSent') {
|
|
701
|
-
return
|
|
972
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
973
|
+
style: {
|
|
702
974
|
minHeight: '100vh',
|
|
703
975
|
display: 'flex',
|
|
704
976
|
alignItems: 'center',
|
|
705
977
|
justifyContent: 'center',
|
|
706
978
|
background: 'var(--theme-bg)',
|
|
707
|
-
padding: 'var(--base)'
|
|
708
|
-
},
|
|
979
|
+
padding: 'var(--base)'
|
|
980
|
+
},
|
|
981
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
982
|
+
style: {
|
|
709
983
|
background: 'var(--theme-elevation-50)',
|
|
710
984
|
padding: 'calc(var(--base) * 2)',
|
|
711
985
|
borderRadius: 'var(--style-radius-m)',
|
|
712
986
|
boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
|
|
713
987
|
width: '100%',
|
|
714
988
|
maxWidth: '400px',
|
|
715
|
-
textAlign: 'center'
|
|
716
|
-
},
|
|
717
|
-
|
|
718
|
-
|
|
989
|
+
textAlign: 'center'
|
|
990
|
+
},
|
|
991
|
+
children: [
|
|
992
|
+
logo && /*#__PURE__*/ _jsx("div", {
|
|
993
|
+
style: {
|
|
994
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
995
|
+
},
|
|
996
|
+
children: logo
|
|
997
|
+
}),
|
|
998
|
+
/*#__PURE__*/ _jsx("div", {
|
|
999
|
+
style: {
|
|
719
1000
|
width: '64px',
|
|
720
1001
|
height: '64px',
|
|
721
1002
|
background: 'var(--theme-success-100)',
|
|
@@ -724,71 +1005,136 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
724
1005
|
alignItems: 'center',
|
|
725
1006
|
justifyContent: 'center',
|
|
726
1007
|
margin: '0 auto calc(var(--base) * 1.5)',
|
|
727
|
-
fontSize: '28px'
|
|
728
|
-
},
|
|
1008
|
+
fontSize: '28px'
|
|
1009
|
+
},
|
|
1010
|
+
children: "✓"
|
|
1011
|
+
}),
|
|
1012
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
1013
|
+
style: {
|
|
729
1014
|
color: 'var(--theme-text)',
|
|
730
1015
|
fontSize: 'var(--font-size-h3)',
|
|
731
1016
|
fontWeight: 600,
|
|
732
|
-
margin: '0 0 calc(var(--base) * 0.5) 0'
|
|
733
|
-
},
|
|
1017
|
+
margin: '0 0 calc(var(--base) * 0.5) 0'
|
|
1018
|
+
},
|
|
1019
|
+
children: "Check Your Email"
|
|
1020
|
+
}),
|
|
1021
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
1022
|
+
style: {
|
|
734
1023
|
color: 'var(--theme-text)',
|
|
735
1024
|
opacity: 0.7,
|
|
736
1025
|
fontSize: 'var(--font-size-small)',
|
|
737
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
738
|
-
},
|
|
1026
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
1027
|
+
},
|
|
1028
|
+
children: [
|
|
1029
|
+
"We've sent a password reset link to ",
|
|
1030
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
1031
|
+
children: email
|
|
1032
|
+
})
|
|
1033
|
+
]
|
|
1034
|
+
}),
|
|
1035
|
+
/*#__PURE__*/ _jsx("p", {
|
|
1036
|
+
style: {
|
|
739
1037
|
color: 'var(--theme-text)',
|
|
740
1038
|
opacity: 0.6,
|
|
741
1039
|
fontSize: 'var(--font-size-small)',
|
|
742
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
743
|
-
},
|
|
1040
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
1041
|
+
},
|
|
1042
|
+
children: "Didn't receive the email? Check your spam folder or try again."
|
|
1043
|
+
}),
|
|
1044
|
+
/*#__PURE__*/ _jsx("button", {
|
|
1045
|
+
type: "button",
|
|
1046
|
+
onClick: handleBackToLogin,
|
|
1047
|
+
style: {
|
|
744
1048
|
padding: 'calc(var(--base) * 0.75) calc(var(--base) * 1.5)',
|
|
745
1049
|
background: 'var(--theme-elevation-150)',
|
|
746
1050
|
border: 'none',
|
|
747
1051
|
borderRadius: 'var(--style-radius-s)',
|
|
748
1052
|
color: 'var(--theme-text)',
|
|
749
1053
|
fontSize: 'var(--font-size-base)',
|
|
750
|
-
cursor: 'pointer'
|
|
751
|
-
},
|
|
1054
|
+
cursor: 'pointer'
|
|
1055
|
+
},
|
|
1056
|
+
children: "Back to login"
|
|
1057
|
+
})
|
|
1058
|
+
]
|
|
1059
|
+
})
|
|
1060
|
+
});
|
|
752
1061
|
}
|
|
753
1062
|
// Main login view
|
|
754
|
-
return
|
|
1063
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
1064
|
+
style: {
|
|
755
1065
|
minHeight: '100vh',
|
|
756
1066
|
display: 'flex',
|
|
757
1067
|
alignItems: 'center',
|
|
758
1068
|
justifyContent: 'center',
|
|
759
1069
|
background: 'var(--theme-bg)',
|
|
760
|
-
padding: 'var(--base)'
|
|
761
|
-
},
|
|
1070
|
+
padding: 'var(--base)'
|
|
1071
|
+
},
|
|
1072
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
1073
|
+
style: {
|
|
762
1074
|
background: 'var(--theme-elevation-50)',
|
|
763
1075
|
padding: 'calc(var(--base) * 2)',
|
|
764
1076
|
borderRadius: 'var(--style-radius-m)',
|
|
765
1077
|
boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
|
|
766
1078
|
width: '100%',
|
|
767
|
-
maxWidth: '400px'
|
|
768
|
-
},
|
|
1079
|
+
maxWidth: '400px'
|
|
1080
|
+
},
|
|
1081
|
+
children: [
|
|
1082
|
+
logo && /*#__PURE__*/ _jsx("div", {
|
|
1083
|
+
style: {
|
|
769
1084
|
textAlign: 'center',
|
|
770
|
-
marginBottom: 'calc(var(--base) * 1.5)'
|
|
771
|
-
},
|
|
1085
|
+
marginBottom: 'calc(var(--base) * 1.5)'
|
|
1086
|
+
},
|
|
1087
|
+
children: logo
|
|
1088
|
+
}),
|
|
1089
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
1090
|
+
style: {
|
|
772
1091
|
color: 'var(--theme-text)',
|
|
773
1092
|
fontSize: 'var(--font-size-h3)',
|
|
774
1093
|
fontWeight: 600,
|
|
775
1094
|
textAlign: 'center',
|
|
776
|
-
margin: '0 0 calc(var(--base) * 1.5) 0'
|
|
777
|
-
},
|
|
1095
|
+
margin: '0 0 calc(var(--base) * 1.5) 0'
|
|
1096
|
+
},
|
|
1097
|
+
children: title
|
|
1098
|
+
}),
|
|
1099
|
+
successMessage && /*#__PURE__*/ _jsx("div", {
|
|
1100
|
+
style: {
|
|
778
1101
|
color: 'var(--theme-success-500)',
|
|
779
1102
|
marginBottom: 'var(--base)',
|
|
780
1103
|
fontSize: 'var(--font-size-small)',
|
|
781
1104
|
padding: 'calc(var(--base) * 0.5)',
|
|
782
1105
|
background: 'var(--theme-success-50)',
|
|
783
1106
|
borderRadius: 'var(--style-radius-s)',
|
|
784
|
-
border: '1px solid var(--theme-success-200)'
|
|
785
|
-
},
|
|
1107
|
+
border: '1px solid var(--theme-success-200)'
|
|
1108
|
+
},
|
|
1109
|
+
children: successMessage
|
|
1110
|
+
}),
|
|
1111
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
1112
|
+
onSubmit: handleSubmit,
|
|
1113
|
+
children: [
|
|
1114
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1115
|
+
style: {
|
|
1116
|
+
marginBottom: 'var(--base)'
|
|
1117
|
+
},
|
|
1118
|
+
children: [
|
|
1119
|
+
/*#__PURE__*/ _jsx("label", {
|
|
1120
|
+
htmlFor: "email",
|
|
1121
|
+
style: {
|
|
786
1122
|
display: 'block',
|
|
787
1123
|
color: 'var(--theme-text)',
|
|
788
1124
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
789
1125
|
fontSize: 'var(--font-size-small)',
|
|
790
|
-
fontWeight: 500
|
|
791
|
-
},
|
|
1126
|
+
fontWeight: 500
|
|
1127
|
+
},
|
|
1128
|
+
children: "Email"
|
|
1129
|
+
}),
|
|
1130
|
+
/*#__PURE__*/ _jsx("input", {
|
|
1131
|
+
id: "email",
|
|
1132
|
+
type: "email",
|
|
1133
|
+
value: email,
|
|
1134
|
+
onChange: (e)=>setEmail(e.target.value),
|
|
1135
|
+
required: true,
|
|
1136
|
+
autoComplete: "email",
|
|
1137
|
+
style: {
|
|
792
1138
|
width: '100%',
|
|
793
1139
|
padding: 'calc(var(--base) * 0.75)',
|
|
794
1140
|
background: 'var(--theme-input-bg)',
|
|
@@ -797,14 +1143,35 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
797
1143
|
color: 'var(--theme-text)',
|
|
798
1144
|
fontSize: 'var(--font-size-base)',
|
|
799
1145
|
outline: 'none',
|
|
800
|
-
boxSizing: 'border-box'
|
|
801
|
-
}
|
|
1146
|
+
boxSizing: 'border-box'
|
|
1147
|
+
}
|
|
1148
|
+
})
|
|
1149
|
+
]
|
|
1150
|
+
}),
|
|
1151
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1152
|
+
style: {
|
|
1153
|
+
marginBottom: 'var(--base)'
|
|
1154
|
+
},
|
|
1155
|
+
children: [
|
|
1156
|
+
/*#__PURE__*/ _jsx("label", {
|
|
1157
|
+
htmlFor: "password",
|
|
1158
|
+
style: {
|
|
802
1159
|
display: 'block',
|
|
803
1160
|
color: 'var(--theme-text)',
|
|
804
1161
|
marginBottom: 'calc(var(--base) * 0.5)',
|
|
805
1162
|
fontSize: 'var(--font-size-small)',
|
|
806
|
-
fontWeight: 500
|
|
807
|
-
},
|
|
1163
|
+
fontWeight: 500
|
|
1164
|
+
},
|
|
1165
|
+
children: "Password"
|
|
1166
|
+
}),
|
|
1167
|
+
/*#__PURE__*/ _jsx("input", {
|
|
1168
|
+
id: "password",
|
|
1169
|
+
type: "password",
|
|
1170
|
+
value: password,
|
|
1171
|
+
onChange: (e)=>setPassword(e.target.value),
|
|
1172
|
+
required: true,
|
|
1173
|
+
autoComplete: "current-password",
|
|
1174
|
+
style: {
|
|
808
1175
|
width: '100%',
|
|
809
1176
|
padding: 'calc(var(--base) * 0.75)',
|
|
810
1177
|
background: 'var(--theme-input-bg)',
|
|
@@ -813,11 +1180,20 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
813
1180
|
color: 'var(--theme-text)',
|
|
814
1181
|
fontSize: 'var(--font-size-base)',
|
|
815
1182
|
outline: 'none',
|
|
816
|
-
boxSizing: 'border-box'
|
|
817
|
-
}
|
|
1183
|
+
boxSizing: 'border-box'
|
|
1184
|
+
}
|
|
1185
|
+
})
|
|
1186
|
+
]
|
|
1187
|
+
}),
|
|
1188
|
+
forgotPasswordAvailable && /*#__PURE__*/ _jsx("div", {
|
|
1189
|
+
style: {
|
|
818
1190
|
marginBottom: 'calc(var(--base) * 1.5)',
|
|
819
|
-
textAlign: 'right'
|
|
820
|
-
},
|
|
1191
|
+
textAlign: 'right'
|
|
1192
|
+
},
|
|
1193
|
+
children: /*#__PURE__*/ _jsx("button", {
|
|
1194
|
+
type: "button",
|
|
1195
|
+
onClick: ()=>switchView('forgotPassword'),
|
|
1196
|
+
style: {
|
|
821
1197
|
background: 'none',
|
|
822
1198
|
border: 'none',
|
|
823
1199
|
color: 'var(--theme-text)',
|
|
@@ -825,16 +1201,27 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
825
1201
|
cursor: 'pointer',
|
|
826
1202
|
fontSize: 'var(--font-size-small)',
|
|
827
1203
|
padding: 0,
|
|
828
|
-
textDecoration: 'underline'
|
|
829
|
-
},
|
|
1204
|
+
textDecoration: 'underline'
|
|
1205
|
+
},
|
|
1206
|
+
children: "Forgot password?"
|
|
1207
|
+
})
|
|
1208
|
+
}),
|
|
1209
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
1210
|
+
style: {
|
|
830
1211
|
color: 'var(--theme-error-500)',
|
|
831
1212
|
marginBottom: 'var(--base)',
|
|
832
1213
|
fontSize: 'var(--font-size-small)',
|
|
833
1214
|
padding: 'calc(var(--base) * 0.5)',
|
|
834
1215
|
background: 'var(--theme-error-50)',
|
|
835
1216
|
borderRadius: 'var(--style-radius-s)',
|
|
836
|
-
border: '1px solid var(--theme-error-200)'
|
|
837
|
-
},
|
|
1217
|
+
border: '1px solid var(--theme-error-200)'
|
|
1218
|
+
},
|
|
1219
|
+
children: error
|
|
1220
|
+
}),
|
|
1221
|
+
/*#__PURE__*/ _jsx("button", {
|
|
1222
|
+
type: "submit",
|
|
1223
|
+
disabled: loading || passkeyLoading,
|
|
1224
|
+
style: {
|
|
838
1225
|
width: '100%',
|
|
839
1226
|
padding: 'calc(var(--base) * 0.75)',
|
|
840
1227
|
background: 'var(--theme-elevation-800)',
|
|
@@ -845,25 +1232,51 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
845
1232
|
fontWeight: 500,
|
|
846
1233
|
cursor: loading || passkeyLoading ? 'not-allowed' : 'pointer',
|
|
847
1234
|
opacity: loading || passkeyLoading ? 0.7 : 1,
|
|
848
|
-
transition: 'opacity 150ms ease'
|
|
849
|
-
},
|
|
1235
|
+
transition: 'opacity 150ms ease'
|
|
1236
|
+
},
|
|
1237
|
+
children: loading ? 'Signing in...' : 'Sign In'
|
|
1238
|
+
})
|
|
1239
|
+
]
|
|
1240
|
+
}),
|
|
1241
|
+
passkeyAvailable && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1242
|
+
children: [
|
|
1243
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1244
|
+
style: {
|
|
850
1245
|
display: 'flex',
|
|
851
1246
|
alignItems: 'center',
|
|
852
1247
|
margin: 'calc(var(--base) * 1.5) 0',
|
|
853
|
-
gap: 'calc(var(--base) * 1)'
|
|
854
|
-
},
|
|
1248
|
+
gap: 'calc(var(--base) * 1)'
|
|
1249
|
+
},
|
|
1250
|
+
children: [
|
|
1251
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1252
|
+
style: {
|
|
855
1253
|
flex: 1,
|
|
856
1254
|
height: '1px',
|
|
857
|
-
background: 'var(--theme-elevation-150)'
|
|
858
|
-
}
|
|
1255
|
+
background: 'var(--theme-elevation-150)'
|
|
1256
|
+
}
|
|
1257
|
+
}),
|
|
1258
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1259
|
+
style: {
|
|
859
1260
|
color: 'var(--theme-text)',
|
|
860
1261
|
opacity: 0.6,
|
|
861
|
-
fontSize: 'var(--font-size-small)'
|
|
862
|
-
},
|
|
1262
|
+
fontSize: 'var(--font-size-small)'
|
|
1263
|
+
},
|
|
1264
|
+
children: "or"
|
|
1265
|
+
}),
|
|
1266
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1267
|
+
style: {
|
|
863
1268
|
flex: 1,
|
|
864
1269
|
height: '1px',
|
|
865
|
-
background: 'var(--theme-elevation-150)'
|
|
866
|
-
}
|
|
1270
|
+
background: 'var(--theme-elevation-150)'
|
|
1271
|
+
}
|
|
1272
|
+
})
|
|
1273
|
+
]
|
|
1274
|
+
}),
|
|
1275
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
1276
|
+
type: "button",
|
|
1277
|
+
onClick: handlePasskeySignIn,
|
|
1278
|
+
disabled: loading || passkeyLoading,
|
|
1279
|
+
style: {
|
|
867
1280
|
width: '100%',
|
|
868
1281
|
padding: 'calc(var(--base) * 0.75)',
|
|
869
1282
|
background: 'transparent',
|
|
@@ -878,22 +1291,51 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
878
1291
|
display: 'flex',
|
|
879
1292
|
alignItems: 'center',
|
|
880
1293
|
justifyContent: 'center',
|
|
881
|
-
gap: 'calc(var(--base) * 0.5)'
|
|
882
|
-
},
|
|
1294
|
+
gap: 'calc(var(--base) * 0.5)'
|
|
1295
|
+
},
|
|
1296
|
+
children: [
|
|
1297
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1298
|
+
style: {
|
|
1299
|
+
fontSize: '18px'
|
|
1300
|
+
},
|
|
1301
|
+
children: "🔐"
|
|
1302
|
+
}),
|
|
1303
|
+
passkeyLoading ? 'Authenticating...' : 'Sign in with Passkey'
|
|
1304
|
+
]
|
|
1305
|
+
})
|
|
1306
|
+
]
|
|
1307
|
+
}),
|
|
1308
|
+
signUpAvailable && /*#__PURE__*/ _jsxs("div", {
|
|
1309
|
+
style: {
|
|
883
1310
|
marginTop: 'calc(var(--base) * 1.5)',
|
|
884
1311
|
textAlign: 'center',
|
|
885
1312
|
fontSize: 'var(--font-size-small)',
|
|
886
1313
|
color: 'var(--theme-text)',
|
|
887
|
-
opacity: 0.8
|
|
888
|
-
},
|
|
1314
|
+
opacity: 0.8
|
|
1315
|
+
},
|
|
1316
|
+
children: [
|
|
1317
|
+
"Don't have an account?",
|
|
1318
|
+
' ',
|
|
1319
|
+
/*#__PURE__*/ _jsx("button", {
|
|
1320
|
+
type: "button",
|
|
1321
|
+
onClick: ()=>switchView('register'),
|
|
1322
|
+
style: {
|
|
889
1323
|
background: 'none',
|
|
890
1324
|
border: 'none',
|
|
891
1325
|
color: 'var(--theme-elevation-800)',
|
|
892
1326
|
cursor: 'pointer',
|
|
893
1327
|
fontSize: 'inherit',
|
|
894
1328
|
textDecoration: 'underline',
|
|
895
|
-
padding: 0
|
|
896
|
-
},
|
|
1329
|
+
padding: 0
|
|
1330
|
+
},
|
|
1331
|
+
children: "Create account"
|
|
1332
|
+
})
|
|
1333
|
+
]
|
|
1334
|
+
})
|
|
1335
|
+
]
|
|
1336
|
+
})
|
|
1337
|
+
});
|
|
897
1338
|
}
|
|
898
1339
|
export default LoginView;
|
|
1340
|
+
|
|
899
1341
|
//# sourceMappingURL=LoginView.js.map
|