@burdenoff/microfe-auth 2026.514.2 → 2026.514.4
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.
|
@@ -4,16 +4,16 @@ import { useMyWorkspaces as n } from "../hooks/useMyWorkspaces.js";
|
|
|
4
4
|
import { useOAuthOperations as r } from "../hooks/useOAuthOperations.js";
|
|
5
5
|
import "../hooks/index.js";
|
|
6
6
|
import { AuthLayout as i } from "../components/AuthLayout.js";
|
|
7
|
-
import { AlertIcon as a, EmailIcon as ee, EyeIcon as te, EyeOffIcon as ne,
|
|
8
|
-
import { useCaptchaV3 as
|
|
9
|
-
import { useCallback as
|
|
10
|
-
import { SSORedirectSpinner as
|
|
11
|
-
import { useLocation as
|
|
12
|
-
import { useActiveContext as
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { getProfileTokens as
|
|
7
|
+
import { AlertIcon as a, EmailIcon as ee, EyeIcon as te, EyeOffIcon as ne, GoogleIcon as re, LockIcon as ie, MicrosoftIcon as ae, SpinnerIcon as oe } from "../components/AuthIcons.js";
|
|
8
|
+
import { useCaptchaV3 as se } from "../hooks/useCaptchaV3.js";
|
|
9
|
+
import { useCallback as o, useEffect as s, useRef as ce, useState as c } from "react";
|
|
10
|
+
import { SSORedirectSpinner as le, getSSORedirectUrl as ue } from "@burdenoff/fe-libs/shared/components";
|
|
11
|
+
import { useLocation as de, useNavigate as fe, useSearchParams as pe } from "react-router-dom";
|
|
12
|
+
import { useActiveContext as me, useI18n as he } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
13
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
14
|
+
import { getProfileTokens as ge, getProfileUser as _e, getProfiles as ve, resolveActiveProfileId as ye } from "@burdenoff/fe-libs/shared/providers/shell/ProfileStorageManager";
|
|
15
15
|
//#region src/auth/pages/LoginPage.tsx
|
|
16
|
-
function
|
|
16
|
+
function be(e) {
|
|
17
17
|
try {
|
|
18
18
|
let t = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "="), r = JSON.parse(atob(n));
|
|
19
19
|
return typeof r.exp == "number" && r.exp > Date.now() / 1e3;
|
|
@@ -21,7 +21,7 @@ function ve(e) {
|
|
|
21
21
|
return !1;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function xe(e) {
|
|
25
25
|
if (!e) return null;
|
|
26
26
|
try {
|
|
27
27
|
let t = new URL(decodeURIComponent(e), window.location.origin);
|
|
@@ -30,11 +30,11 @@ function ye(e) {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let
|
|
35
|
-
let n =
|
|
33
|
+
function f() {
|
|
34
|
+
let f = fe(), p = de(), [m] = pe(), { t: h } = he(), g = o((e, t) => {
|
|
35
|
+
let n = h(e);
|
|
36
36
|
return n === e ? t : n;
|
|
37
|
-
}, [
|
|
37
|
+
}, [h]), { signIn: Se, isLoading: _, error: v, errorCode: y, resendVerification: Ce } = t(), { completeAuthFlow: we } = n(), { setWorkspace: b, setOrganization: x } = me(), { initiateGoogleOAuth: Te, initiateMicrosoftOAuth: Ee, isProviderConfigured: S } = r(), C = e((e) => e.mfaRequired), { executeRecaptcha: De } = se(), [w, T] = c(!1), [Oe, ke] = c(!1), E = o((e) => {
|
|
38
38
|
if (typeof window < "u") {
|
|
39
39
|
try {
|
|
40
40
|
sessionStorage.setItem("bf-post-login-return-to", e);
|
|
@@ -42,36 +42,36 @@ function h() {
|
|
|
42
42
|
window.location.assign(e);
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
}, [
|
|
45
|
+
f(e);
|
|
46
|
+
}, [f]), [D, Ae] = c(!1), [O, k] = c(!1), [je, A] = c(!1), [Me, j] = c(!1), [M, N] = c(!1), [P, F] = c(!1), [I, L] = c(!1), [Ne, R] = c(!1), [z, B] = c(null), [V, H] = c(null), [U, W] = c({
|
|
47
47
|
email: "",
|
|
48
48
|
password: "",
|
|
49
49
|
rememberMe: !1
|
|
50
|
-
}), [
|
|
51
|
-
|
|
52
|
-
!
|
|
53
|
-
}, [
|
|
54
|
-
if (
|
|
55
|
-
let t =
|
|
50
|
+
}), [G, K] = c(null), [q, J] = c(!1), Y = m.get("mode") === "add-account", X = m.get("returnTo"), Z = ce(X);
|
|
51
|
+
s(() => {
|
|
52
|
+
!Z.current && X && (Z.current = X);
|
|
53
|
+
}, [X]), s(() => {
|
|
54
|
+
if (Y || w) return;
|
|
55
|
+
let t = ye();
|
|
56
56
|
if (t) {
|
|
57
|
-
let n =
|
|
58
|
-
if (n?.accessToken && r &&
|
|
59
|
-
e.getState().loadFromProfile(t),
|
|
57
|
+
let n = ge(t), r = _e(t);
|
|
58
|
+
if (n?.accessToken && r && be(n.accessToken)) {
|
|
59
|
+
e.getState().loadFromProfile(t), E(xe(X) ?? "/");
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
let n =
|
|
64
|
-
n && (
|
|
63
|
+
let n = ue();
|
|
64
|
+
n && (ke(!0), window.location.replace(n));
|
|
65
65
|
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]),
|
|
66
|
+
Y,
|
|
67
|
+
w,
|
|
68
|
+
E,
|
|
69
|
+
X
|
|
70
|
+
]), s(() => {
|
|
71
71
|
try {
|
|
72
72
|
localStorage.removeItem("remembered_password");
|
|
73
73
|
let e = localStorage.getItem("remembered_email");
|
|
74
|
-
e &&
|
|
74
|
+
e && W((t) => ({
|
|
75
75
|
...t,
|
|
76
76
|
email: e,
|
|
77
77
|
rememberMe: !0
|
|
@@ -79,13 +79,13 @@ function h() {
|
|
|
79
79
|
} catch (e) {
|
|
80
80
|
console.warn("[LoginPage] Failed to load remembered email:", e);
|
|
81
81
|
}
|
|
82
|
-
}, []),
|
|
83
|
-
let e =
|
|
84
|
-
e?.message &&
|
|
82
|
+
}, []), s(() => {
|
|
83
|
+
let e = p.state;
|
|
84
|
+
e?.message && H(e.message), e?.email && W((t) => ({
|
|
85
85
|
...t,
|
|
86
86
|
email: e.email
|
|
87
87
|
})), e && window.history.replaceState({}, document.title);
|
|
88
|
-
}, [
|
|
88
|
+
}, [p.state]);
|
|
89
89
|
let Pe = (e, t) => {
|
|
90
90
|
if (t) switch (t) {
|
|
91
91
|
case "ACCOUNT_DELETED": return "DELETED";
|
|
@@ -99,44 +99,44 @@ function h() {
|
|
|
99
99
|
let n = e.toLowerCase();
|
|
100
100
|
return n.includes("deleted") || n.includes("permanently deleted") ? "DELETED" : n.includes("suspended") ? "SUSPENDED" : n.includes("oauth provider") || n.includes("oauth-only") || n.includes("oauth only") ? "OAUTH_ONLY" : n.includes("inactive") || n.includes("deactivated") || n.includes("not active") ? "INACTIVE" : n.includes("verify your email") || n.includes("email not verified") || n.includes("email_not_verified") ? "EMAIL_NOT_VERIFIED" : null;
|
|
101
101
|
};
|
|
102
|
-
|
|
103
|
-
let e =
|
|
104
|
-
if (e &&
|
|
102
|
+
s(() => {
|
|
103
|
+
let e = m.get("email");
|
|
104
|
+
if (e && W((t) => ({
|
|
105
105
|
...t,
|
|
106
106
|
email: e
|
|
107
|
-
})),
|
|
108
|
-
|
|
107
|
+
})), m.get("expired") === "true") {
|
|
108
|
+
H(g("auth.login.sessionExpired", "Your session has expired. Please sign in again."));
|
|
109
109
|
let e = window.location.pathname;
|
|
110
110
|
window.history.replaceState({}, document.title, e);
|
|
111
111
|
}
|
|
112
|
-
}, [
|
|
113
|
-
|
|
114
|
-
}, [
|
|
112
|
+
}, [m, g]), s(() => {
|
|
113
|
+
C && f("/auth/mfa-verify");
|
|
114
|
+
}, [C, f]);
|
|
115
115
|
let Fe = async (t) => {
|
|
116
|
-
t.preventDefault(),
|
|
117
|
-
let n = (
|
|
116
|
+
t.preventDefault(), k(!1), A(!1), j(!1), N(!1), F(!1), J(!1), R(!1), K(null);
|
|
117
|
+
let n = (U.email ?? "").trim();
|
|
118
118
|
if (!n) {
|
|
119
|
-
|
|
119
|
+
K(g("auth.login.enterEmailOrUsername", "Please enter your email or username"));
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
if (n.includes("@") && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)) {
|
|
123
|
-
|
|
123
|
+
K(g("auth.login.invalidEmail", "Please enter a valid email address"));
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
if (!
|
|
127
|
-
|
|
126
|
+
if (!U.password || U.password.length < 1) {
|
|
127
|
+
K(g("auth.login.enterPassword", "Please enter your password"));
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
if (
|
|
131
|
-
|
|
130
|
+
if (Y && ve().some((e) => e.email.toLowerCase() === n.toLowerCase())) {
|
|
131
|
+
J(!0), K(null);
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
J(!1);
|
|
135
135
|
try {
|
|
136
|
-
let e = await
|
|
136
|
+
let e = await De("login"), t = await Se({
|
|
137
137
|
email: n,
|
|
138
|
-
password:
|
|
139
|
-
rememberMe:
|
|
138
|
+
password: U.password,
|
|
139
|
+
rememberMe: U.rememberMe,
|
|
140
140
|
...e ? { recaptchaToken: e } : {}
|
|
141
141
|
});
|
|
142
142
|
if (t.requiresMFA) return;
|
|
@@ -152,14 +152,14 @@ function h() {
|
|
|
152
152
|
}
|
|
153
153
|
} catch {}
|
|
154
154
|
try {
|
|
155
|
-
|
|
155
|
+
U.rememberMe ? localStorage.setItem("remembered_email", n) : localStorage.removeItem("remembered_email");
|
|
156
156
|
} catch (e) {
|
|
157
157
|
console.warn("[LoginPage] Failed to save/clear remembered email:", e);
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
let e =
|
|
159
|
+
T(!0);
|
|
160
|
+
let e = Z.current || X, r = e ? decodeURIComponent(e) : "/dashboard";
|
|
161
161
|
try {
|
|
162
|
-
let e = await Promise.race([
|
|
162
|
+
let e = await Promise.race([we(t.token), new Promise((e) => {
|
|
163
163
|
window.setTimeout(() => {
|
|
164
164
|
e({
|
|
165
165
|
success: !1,
|
|
@@ -167,280 +167,270 @@ function h() {
|
|
|
167
167
|
});
|
|
168
168
|
}, 5e3);
|
|
169
169
|
})]);
|
|
170
|
-
e.success ? (e.workspace && (
|
|
170
|
+
e.success ? (e.workspace && (b(e.workspace.id), e.workspace.organizationId && x(e.workspace.organizationId)), E(r)) : e.error?.includes("No workspaces found") ? f("/onboarding/create-workspace") : (e.workspace && (b(e.workspace.id), e.workspace.organizationId && x(e.workspace.organizationId)), console.warn("Auth flow warning:", e.error), E(r));
|
|
171
171
|
} catch (e) {
|
|
172
|
-
console.error("Auth flow error (login succeeded):", e),
|
|
172
|
+
console.error("Auth flow error (login succeeded):", e), E(r);
|
|
173
173
|
} finally {
|
|
174
|
-
|
|
174
|
+
T(!1);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
} catch (t) {
|
|
178
178
|
let n = t instanceof Error ? t.message : String(t);
|
|
179
|
-
n.includes("reCAPTCHA") &&
|
|
179
|
+
n.includes("reCAPTCHA") && K(n);
|
|
180
180
|
let r = e.getState().errorCode, i = Pe(n, r);
|
|
181
|
-
i === "DELETED" ?
|
|
181
|
+
i === "DELETED" ? A(!0) : i === "SUSPENDED" ? j(!0) : i === "OAUTH_ONLY" ? N(!0) : i === "INACTIVE" ? k(!0) : i === "EMAIL_NOT_VERIFIED" && F(!0);
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
|
-
|
|
185
|
-
if (
|
|
186
|
-
let e = Pe(
|
|
187
|
-
e === "DELETED" ?
|
|
184
|
+
s(() => {
|
|
185
|
+
if (v) {
|
|
186
|
+
let e = Pe(v, y);
|
|
187
|
+
e === "DELETED" ? A(!0) : e === "SUSPENDED" ? j(!0) : e === "OAUTH_ONLY" ? N(!0) : e === "INACTIVE" ? k(!0) : e === "EMAIL_NOT_VERIFIED" && F(!0);
|
|
188
188
|
}
|
|
189
|
-
}, [
|
|
189
|
+
}, [v, y]);
|
|
190
190
|
let Ie = () => {
|
|
191
|
-
|
|
191
|
+
B(null);
|
|
192
192
|
try {
|
|
193
|
-
|
|
193
|
+
Te();
|
|
194
194
|
} catch (e) {
|
|
195
|
-
|
|
195
|
+
B(e instanceof Error ? e.message : g("auth.login.googleSignInFailed", "Failed to initiate Google sign in"));
|
|
196
196
|
}
|
|
197
|
-
},
|
|
198
|
-
|
|
197
|
+
}, Q = () => {
|
|
198
|
+
B(null);
|
|
199
199
|
try {
|
|
200
|
-
|
|
200
|
+
Ee();
|
|
201
201
|
} catch (e) {
|
|
202
|
-
|
|
202
|
+
B(e instanceof Error ? e.message : g("auth.login.microsoftSignInFailed", "Failed to initiate Microsoft sign in"));
|
|
203
203
|
}
|
|
204
|
-
},
|
|
205
|
-
|
|
204
|
+
}, Le = async () => {
|
|
205
|
+
L(!0), R(!1);
|
|
206
206
|
try {
|
|
207
|
-
(await
|
|
207
|
+
(await Ce((U.email ?? "").trim())).success ? R(!0) : K(g("auth.login.resendFailed", "Failed to resend verification email. Please try again."));
|
|
208
208
|
} catch (e) {
|
|
209
|
-
console.error("Failed to resend verification email:", e),
|
|
209
|
+
console.error("Failed to resend verification email:", e), K(e instanceof Error ? e.message : g("auth.login.resendFailed", "Failed to resend verification email. Please try again."));
|
|
210
210
|
} finally {
|
|
211
|
-
|
|
211
|
+
L(!1);
|
|
212
212
|
}
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
name: "Microsoft",
|
|
230
|
-
icon: s,
|
|
231
|
-
onClick: Le,
|
|
232
|
-
disabled: !$,
|
|
233
|
-
tooltip: $ ? void 0 : y("auth.login.microsoftNotConfigured", "Microsoft sign in is not configured")
|
|
234
|
-
}
|
|
235
|
-
];
|
|
236
|
-
return Ee ? /* @__PURE__ */ p(se, {}) : /* @__PURE__ */ m(i, {
|
|
237
|
-
title: y("auth.login.welcomeBack", "Welcome back"),
|
|
238
|
-
subtitle: y("auth.login.enterCredentials", "Enter your credentials to continue"),
|
|
213
|
+
}, Re = S("google"), $ = S("microsoft"), ze = [{
|
|
214
|
+
name: "Google",
|
|
215
|
+
icon: re,
|
|
216
|
+
onClick: Ie,
|
|
217
|
+
disabled: !Re,
|
|
218
|
+
tooltip: Re ? void 0 : g("auth.login.googleNotConfigured", "Google sign in is not configured")
|
|
219
|
+
}, {
|
|
220
|
+
name: "Microsoft",
|
|
221
|
+
icon: ae,
|
|
222
|
+
onClick: Q,
|
|
223
|
+
disabled: !$,
|
|
224
|
+
tooltip: $ ? void 0 : g("auth.login.microsoftNotConfigured", "Microsoft sign in is not configured")
|
|
225
|
+
}];
|
|
226
|
+
return Oe ? /* @__PURE__ */ u(le, {}) : /* @__PURE__ */ d(i, {
|
|
227
|
+
title: g("auth.login.welcomeBack", "Welcome back"),
|
|
228
|
+
subtitle: g("auth.login.enterCredentials", "Enter your credentials to continue"),
|
|
239
229
|
children: [
|
|
240
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ d("form", {
|
|
241
231
|
onSubmit: Fe,
|
|
242
232
|
className: "space-y-5",
|
|
243
233
|
children: [
|
|
244
|
-
|
|
234
|
+
V && /* @__PURE__ */ d("div", {
|
|
245
235
|
className: "flex items-start gap-3 p-4 rounded-xl border bg-status-info-bg-subtle border-status-info-border",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
236
|
+
children: [/* @__PURE__ */ u("svg", {
|
|
247
237
|
className: "w-5 h-5 flex-shrink-0 mt-0.5 text-text-link",
|
|
248
238
|
fill: "none",
|
|
249
239
|
viewBox: "0 0 24 24",
|
|
250
240
|
stroke: "currentColor",
|
|
251
|
-
children: /* @__PURE__ */
|
|
241
|
+
children: /* @__PURE__ */ u("path", {
|
|
252
242
|
strokeLinecap: "round",
|
|
253
243
|
strokeLinejoin: "round",
|
|
254
244
|
strokeWidth: 2,
|
|
255
245
|
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
256
246
|
})
|
|
257
|
-
}), /* @__PURE__ */
|
|
247
|
+
}), /* @__PURE__ */ u("p", {
|
|
258
248
|
className: "text-sm text-status-info-text",
|
|
259
|
-
children:
|
|
249
|
+
children: V
|
|
260
250
|
})]
|
|
261
251
|
}),
|
|
262
|
-
|
|
252
|
+
G && /* @__PURE__ */ d("div", {
|
|
263
253
|
className: "flex items-start gap-3 p-4 rounded-xl border bg-status-warning-bg-subtle border-status-warning-border",
|
|
264
|
-
children: [/* @__PURE__ */
|
|
254
|
+
children: [/* @__PURE__ */ u(a, { className: "w-5 h-5 flex-shrink-0 mt-0.5 text-status-warning-text" }), /* @__PURE__ */ u("p", {
|
|
265
255
|
className: "text-sm text-status-warning-text",
|
|
266
|
-
children:
|
|
256
|
+
children: G
|
|
267
257
|
})]
|
|
268
258
|
}),
|
|
269
|
-
|
|
259
|
+
q && /* @__PURE__ */ d("div", {
|
|
270
260
|
className: "flex items-start gap-3 p-4 rounded-xl border bg-status-warning-bg-subtle border-status-warning-border",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
261
|
+
children: [/* @__PURE__ */ u(a, { className: "w-5 h-5 flex-shrink-0 mt-0.5 text-status-warning-text" }), /* @__PURE__ */ d("div", {
|
|
272
262
|
className: "flex-1",
|
|
273
263
|
children: [
|
|
274
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ u("p", {
|
|
275
265
|
className: "text-sm font-medium text-status-warning-text",
|
|
276
|
-
children:
|
|
266
|
+
children: g("auth.login.duplicateAccount", "This account is already signed in.")
|
|
277
267
|
}),
|
|
278
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ u("p", {
|
|
279
269
|
className: "mt-1 text-sm text-status-warning-text/80",
|
|
280
|
-
children:
|
|
270
|
+
children: g("auth.login.duplicateAccountHint", "Please use a different account, or go back and switch to this account from the profile menu.")
|
|
281
271
|
}),
|
|
282
|
-
(
|
|
272
|
+
(Z.current || X) && /* @__PURE__ */ d("button", {
|
|
283
273
|
type: "button",
|
|
284
|
-
onClick: () =>
|
|
274
|
+
onClick: () => f(decodeURIComponent(Z.current || X || "/dashboard")),
|
|
285
275
|
className: "mt-3 inline-flex items-center gap-2 px-4 py-2.5 rounded-xl border border-status-warning-border bg-bg-surface text-status-warning-text text-sm font-medium hover:bg-status-warning-bg-subtle hover:border-status-warning-border transition-all shadow-sm",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
276
|
+
children: [/* @__PURE__ */ u("svg", {
|
|
287
277
|
className: "w-4 h-4",
|
|
288
278
|
fill: "none",
|
|
289
279
|
viewBox: "0 0 24 24",
|
|
290
280
|
stroke: "currentColor",
|
|
291
|
-
children: /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ u("path", {
|
|
292
282
|
strokeLinecap: "round",
|
|
293
283
|
strokeLinejoin: "round",
|
|
294
284
|
strokeWidth: 2,
|
|
295
285
|
d: "M10 19l-7-7m0 0l7-7m-7 7h18"
|
|
296
286
|
})
|
|
297
|
-
}),
|
|
287
|
+
}), g("auth.login.goBackSwitchAccount", "Go back and switch account")]
|
|
298
288
|
})
|
|
299
289
|
]
|
|
300
290
|
})]
|
|
301
291
|
}),
|
|
302
|
-
|
|
303
|
-
className: `flex items-start gap-3 p-4 rounded-xl border ${
|
|
304
|
-
children: [/* @__PURE__ */
|
|
292
|
+
v && !G && !q && /* @__PURE__ */ d("div", {
|
|
293
|
+
className: `flex items-start gap-3 p-4 rounded-xl border ${O || M || P ? "bg-status-warning-bg-subtle border-status-warning-border" : "bg-status-error-bg-subtle border-status-error-border"}`,
|
|
294
|
+
children: [/* @__PURE__ */ u(a, { className: `w-5 h-5 flex-shrink-0 mt-0.5 ${O || M || P ? "text-status-warning-text" : "text-status-error-text"}` }), /* @__PURE__ */ d("div", {
|
|
305
295
|
className: "flex-1",
|
|
306
296
|
children: [
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
className: `text-sm ${
|
|
309
|
-
children:
|
|
297
|
+
/* @__PURE__ */ u("p", {
|
|
298
|
+
className: `text-sm ${O || M || P ? "text-status-warning-text" : "text-status-error-text"}`,
|
|
299
|
+
children: je ? g("auth.login.accountDeleted", "This account has been permanently deleted and cannot be recovered.") : Me ? g("auth.login.accountSuspended", "Your account has been suspended. Please contact support for assistance.") : O ? g("auth.login.accountDeactivated", "Your account has been deactivated.") : M ? g("auth.login.oauthOnly", "This account uses OAuth sign-in. Please use Google or Microsoft to sign in.") : P ? g("auth.login.emailNotVerified", "Please verify your email before signing in. Check your inbox for the verification link.") : v
|
|
310
300
|
}),
|
|
311
|
-
|
|
301
|
+
O && /* @__PURE__ */ u("button", {
|
|
312
302
|
type: "button",
|
|
313
|
-
onClick: () =>
|
|
303
|
+
onClick: () => f("/auth/reactivate", { state: { email: U.email } }),
|
|
314
304
|
className: "mt-2 text-sm font-semibold text-status-warning-text hover:text-status-warning-text underline underline-offset-2",
|
|
315
|
-
children:
|
|
305
|
+
children: g("auth.login.clickReactivate", "Click here to reactivate your account")
|
|
316
306
|
}),
|
|
317
|
-
|
|
307
|
+
P && /* @__PURE__ */ u("div", {
|
|
318
308
|
className: "mt-3",
|
|
319
|
-
children:
|
|
309
|
+
children: Ne ? /* @__PURE__ */ d("div", {
|
|
320
310
|
className: "flex items-center gap-2 text-sm text-status-success-text",
|
|
321
|
-
children: [/* @__PURE__ */
|
|
311
|
+
children: [/* @__PURE__ */ u("svg", {
|
|
322
312
|
className: "w-4 h-4",
|
|
323
313
|
fill: "none",
|
|
324
314
|
viewBox: "0 0 24 24",
|
|
325
315
|
stroke: "currentColor",
|
|
326
|
-
children: /* @__PURE__ */
|
|
316
|
+
children: /* @__PURE__ */ u("path", {
|
|
327
317
|
strokeLinecap: "round",
|
|
328
318
|
strokeLinejoin: "round",
|
|
329
319
|
strokeWidth: 2,
|
|
330
320
|
d: "M5 13l4 4L19 7"
|
|
331
321
|
})
|
|
332
|
-
}),
|
|
333
|
-
}) : /* @__PURE__ */
|
|
322
|
+
}), g("auth.login.verificationSent", "Verification email sent! Please check your inbox.")]
|
|
323
|
+
}) : /* @__PURE__ */ u("button", {
|
|
334
324
|
type: "button",
|
|
335
|
-
onClick:
|
|
336
|
-
disabled:
|
|
325
|
+
onClick: Le,
|
|
326
|
+
disabled: I,
|
|
337
327
|
className: "inline-flex items-center gap-2 px-4 py-2.5 rounded-xl border border-status-warning-border bg-bg-surface text-status-warning-text text-sm font-medium hover:bg-status-warning-bg-subtle hover:border-status-warning-border transition-all shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",
|
|
338
|
-
children:
|
|
328
|
+
children: I ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(oe, { className: "w-4 h-4 animate-spin" }), g("auth.login.sending", "Sending...")] }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("svg", {
|
|
339
329
|
className: "w-4 h-4",
|
|
340
330
|
fill: "none",
|
|
341
331
|
viewBox: "0 0 24 24",
|
|
342
332
|
stroke: "currentColor",
|
|
343
|
-
children: /* @__PURE__ */
|
|
333
|
+
children: /* @__PURE__ */ u("path", {
|
|
344
334
|
strokeLinecap: "round",
|
|
345
335
|
strokeLinejoin: "round",
|
|
346
336
|
strokeWidth: 2,
|
|
347
337
|
d: "M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
348
338
|
})
|
|
349
|
-
}),
|
|
339
|
+
}), g("auth.login.resendVerification", "Resend verification email")] })
|
|
350
340
|
})
|
|
351
341
|
}),
|
|
352
|
-
|
|
342
|
+
M && /* @__PURE__ */ d("div", {
|
|
353
343
|
className: "mt-3 flex flex-col gap-2",
|
|
354
|
-
children: [
|
|
344
|
+
children: [S("google") && /* @__PURE__ */ d("button", {
|
|
355
345
|
type: "button",
|
|
356
346
|
onClick: Ie,
|
|
357
347
|
className: "inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl border border-border-default bg-bg-surface text-text-primary text-sm font-medium hover:bg-bg-canvas hover:border-border-default transition-all shadow-sm",
|
|
358
|
-
children: [/* @__PURE__ */
|
|
359
|
-
}),
|
|
348
|
+
children: [/* @__PURE__ */ u(re, { className: "w-5 h-5" }), g("auth.login.signInWithGoogle", "Sign in with Google")]
|
|
349
|
+
}), S("microsoft") && /* @__PURE__ */ d("button", {
|
|
360
350
|
type: "button",
|
|
361
|
-
onClick:
|
|
351
|
+
onClick: Q,
|
|
362
352
|
className: "inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl border border-border-default bg-bg-surface text-text-primary text-sm font-medium hover:bg-bg-canvas hover:border-border-default transition-all shadow-sm",
|
|
363
|
-
children: [/* @__PURE__ */
|
|
353
|
+
children: [/* @__PURE__ */ u(ae, { className: "w-5 h-5" }), g("auth.login.signInWithMicrosoft", "Sign in with Microsoft")]
|
|
364
354
|
})]
|
|
365
355
|
})
|
|
366
356
|
]
|
|
367
357
|
})]
|
|
368
358
|
}),
|
|
369
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ d("div", {
|
|
370
360
|
className: "space-y-2",
|
|
371
|
-
children: [/* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ u("label", {
|
|
372
362
|
htmlFor: "email",
|
|
373
363
|
className: "block text-sm font-medium text-[var(--color-text-primary)]",
|
|
374
|
-
children:
|
|
375
|
-
}), /* @__PURE__ */
|
|
364
|
+
children: g("auth.login.emailLabel", "Email")
|
|
365
|
+
}), /* @__PURE__ */ d("div", {
|
|
376
366
|
className: "relative",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
367
|
+
children: [/* @__PURE__ */ u("div", {
|
|
378
368
|
className: "absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none",
|
|
379
|
-
children: /* @__PURE__ */
|
|
380
|
-
}), /* @__PURE__ */
|
|
369
|
+
children: /* @__PURE__ */ u(ee, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
|
|
370
|
+
}), /* @__PURE__ */ u("input", {
|
|
381
371
|
id: "email",
|
|
382
372
|
type: "text",
|
|
383
373
|
autoComplete: "email username",
|
|
384
374
|
required: !0,
|
|
385
|
-
value:
|
|
386
|
-
onChange: (e) =>
|
|
387
|
-
...
|
|
375
|
+
value: U.email,
|
|
376
|
+
onChange: (e) => W({
|
|
377
|
+
...U,
|
|
388
378
|
email: e.target.value
|
|
389
379
|
}),
|
|
390
380
|
className: "block w-full pl-[3.5rem] pr-4 py-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-tertiary)] focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all",
|
|
391
|
-
placeholder:
|
|
381
|
+
placeholder: g("auth.login.emailPlaceholder", "you@example.com")
|
|
392
382
|
})]
|
|
393
383
|
})]
|
|
394
384
|
}),
|
|
395
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ d("div", {
|
|
396
386
|
className: "space-y-2",
|
|
397
|
-
children: [/* @__PURE__ */
|
|
387
|
+
children: [/* @__PURE__ */ u("label", {
|
|
398
388
|
htmlFor: "password",
|
|
399
389
|
className: "block text-sm font-medium text-[var(--color-text-primary)]",
|
|
400
|
-
children:
|
|
401
|
-
}), /* @__PURE__ */
|
|
390
|
+
children: g("auth.login.passwordLabel", "Password")
|
|
391
|
+
}), /* @__PURE__ */ d("div", {
|
|
402
392
|
className: "relative",
|
|
403
393
|
children: [
|
|
404
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ u("div", {
|
|
405
395
|
className: "absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none",
|
|
406
|
-
children: /* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ u(ie, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
|
|
407
397
|
}),
|
|
408
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ u("input", {
|
|
409
399
|
id: "password",
|
|
410
|
-
type:
|
|
400
|
+
type: D ? "text" : "password",
|
|
411
401
|
autoComplete: "current-password",
|
|
412
402
|
required: !0,
|
|
413
|
-
value:
|
|
414
|
-
onChange: (e) =>
|
|
415
|
-
...
|
|
403
|
+
value: U.password,
|
|
404
|
+
onChange: (e) => W({
|
|
405
|
+
...U,
|
|
416
406
|
password: e.target.value
|
|
417
407
|
}),
|
|
418
408
|
className: "block w-full pl-[3.5rem] pr-12 py-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-tertiary)] focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all",
|
|
419
|
-
placeholder:
|
|
409
|
+
placeholder: g("auth.login.passwordPlaceholder", "Enter your password")
|
|
420
410
|
}),
|
|
421
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ u("button", {
|
|
422
412
|
type: "button",
|
|
423
|
-
onClick: () =>
|
|
424
|
-
"aria-label":
|
|
413
|
+
onClick: () => Ae(!D),
|
|
414
|
+
"aria-label": D ? "Hide password" : "Show password",
|
|
425
415
|
className: "absolute inset-y-0 right-0 pr-3.5 flex items-center text-[var(--color-text-tertiary)] hover:text-[var(--color-text-secondary)] transition-colors",
|
|
426
|
-
children:
|
|
416
|
+
children: u(D ? ne : te, { className: "w-5 h-5" })
|
|
427
417
|
})
|
|
428
418
|
]
|
|
429
419
|
})]
|
|
430
420
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ d("div", {
|
|
432
422
|
className: "flex items-center justify-between",
|
|
433
|
-
children: [/* @__PURE__ */
|
|
423
|
+
children: [/* @__PURE__ */ d("label", {
|
|
434
424
|
className: "flex items-center gap-2 cursor-pointer group",
|
|
435
|
-
children: [/* @__PURE__ */
|
|
425
|
+
children: [/* @__PURE__ */ d("div", {
|
|
436
426
|
className: "relative",
|
|
437
|
-
children: [/* @__PURE__ */
|
|
427
|
+
children: [/* @__PURE__ */ u("input", {
|
|
438
428
|
type: "checkbox",
|
|
439
|
-
checked:
|
|
429
|
+
checked: U.rememberMe,
|
|
440
430
|
onChange: (e) => {
|
|
441
431
|
let t = e.target.checked;
|
|
442
|
-
if (
|
|
443
|
-
...
|
|
432
|
+
if (W({
|
|
433
|
+
...U,
|
|
444
434
|
rememberMe: t
|
|
445
435
|
}), !t) try {
|
|
446
436
|
localStorage.removeItem("remembered_email");
|
|
@@ -449,120 +439,98 @@ function h() {
|
|
|
449
439
|
}
|
|
450
440
|
},
|
|
451
441
|
className: "sr-only peer"
|
|
452
|
-
}), /* @__PURE__ */
|
|
442
|
+
}), /* @__PURE__ */ u("div", {
|
|
453
443
|
className: "w-5 h-5 rounded-md border-2 border-[var(--color-border-default)] bg-[var(--color-bg-surface)] peer-checked:bg-status-info-bg-subtle0 peer-checked:border-action-primary-bg transition-all peer-focus:ring-2 peer-focus:ring-action-primary-bg/20",
|
|
454
|
-
children: /* @__PURE__ */
|
|
444
|
+
children: /* @__PURE__ */ u("svg", {
|
|
455
445
|
className: "w-full h-full text-white opacity-0 peer-checked:opacity-100 transition-opacity p-0.5",
|
|
456
446
|
fill: "none",
|
|
457
447
|
viewBox: "0 0 24 24",
|
|
458
448
|
stroke: "currentColor",
|
|
459
449
|
strokeWidth: 3,
|
|
460
|
-
children: /* @__PURE__ */
|
|
450
|
+
children: /* @__PURE__ */ u("path", {
|
|
461
451
|
strokeLinecap: "round",
|
|
462
452
|
strokeLinejoin: "round",
|
|
463
453
|
d: "M5 13l4 4L19 7"
|
|
464
454
|
})
|
|
465
455
|
})
|
|
466
456
|
})]
|
|
467
|
-
}), /* @__PURE__ */
|
|
457
|
+
}), /* @__PURE__ */ u("span", {
|
|
468
458
|
className: "text-sm text-[var(--color-text-secondary)] group-hover:text-[var(--color-text-primary)] transition-colors",
|
|
469
|
-
children:
|
|
459
|
+
children: g("auth.login.rememberMe", "Remember me")
|
|
470
460
|
})]
|
|
471
|
-
}), /* @__PURE__ */
|
|
461
|
+
}), /* @__PURE__ */ u("button", {
|
|
472
462
|
type: "button",
|
|
473
|
-
onClick: () =>
|
|
463
|
+
onClick: () => f("/auth/reset-password"),
|
|
474
464
|
className: "text-sm font-medium text-text-link hover:text-text-linkHover transition-colors",
|
|
475
|
-
children:
|
|
465
|
+
children: g("auth.login.forgotPassword", "Forgot password?")
|
|
476
466
|
})]
|
|
477
467
|
}),
|
|
478
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ u("button", {
|
|
479
469
|
type: "submit",
|
|
480
|
-
disabled:
|
|
470
|
+
disabled: _ || w,
|
|
481
471
|
className: "auth-primary-button flex w-full items-center justify-center gap-2 px-4 py-3 font-semibold",
|
|
482
|
-
children:
|
|
472
|
+
children: _ || w ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(oe, { className: "w-5 h-5 animate-spin" }), /* @__PURE__ */ u("span", { children: w ? g("auth.login.settingUpWorkspace", "Setting up workspace...") : g("auth.login.signingIn", "Signing in...") })] }) : g("auth.login.signIn", "Sign in")
|
|
483
473
|
})
|
|
484
474
|
]
|
|
485
475
|
}),
|
|
486
|
-
/* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ d("div", {
|
|
487
477
|
className: "relative my-8",
|
|
488
|
-
children: [/* @__PURE__ */
|
|
478
|
+
children: [/* @__PURE__ */ u("div", {
|
|
489
479
|
className: "absolute inset-0 flex items-center",
|
|
490
|
-
children: /* @__PURE__ */
|
|
491
|
-
}), /* @__PURE__ */
|
|
480
|
+
children: /* @__PURE__ */ u("div", { className: "w-full border-t border-[var(--color-border-default)]" })
|
|
481
|
+
}), /* @__PURE__ */ u("div", {
|
|
492
482
|
className: "relative flex justify-center",
|
|
493
|
-
children: /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ u("span", {
|
|
494
484
|
className: "px-4 bg-[var(--color-bg-canvas)] text-sm text-[var(--color-text-tertiary)]",
|
|
495
|
-
children:
|
|
485
|
+
children: g("auth.login.orContinueWith", "or continue with")
|
|
496
486
|
})
|
|
497
487
|
})]
|
|
498
488
|
}),
|
|
499
|
-
|
|
489
|
+
z && /* @__PURE__ */ d("div", {
|
|
500
490
|
className: "flex items-start gap-3 p-4 rounded-xl border bg-status-error-bg-subtle border-status-error-border",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ u(a, { className: "w-5 h-5 flex-shrink-0 mt-0.5 text-status-error-text" }), /* @__PURE__ */ u("p", {
|
|
502
492
|
className: "text-sm text-status-error-text",
|
|
503
|
-
children:
|
|
493
|
+
children: z
|
|
504
494
|
})]
|
|
505
495
|
}),
|
|
506
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ u("div", {
|
|
507
497
|
className: "grid grid-cols-3 gap-3",
|
|
508
|
-
children:
|
|
498
|
+
children: ze.map((e) => /* @__PURE__ */ d("button", {
|
|
509
499
|
type: "button",
|
|
510
500
|
onClick: e.onClick,
|
|
511
501
|
disabled: e.disabled,
|
|
512
502
|
title: e.tooltip,
|
|
513
503
|
className: `flex items-center justify-center gap-2 px-4 py-3 rounded-xl border transition-all duration-200 group ${e.disabled ? "border-[var(--color-border-subtle)] bg-[var(--color-bg-disabled)] cursor-not-allowed opacity-50" : "border-[var(--color-border-default)] bg-[var(--color-bg-surface)] hover:bg-[var(--color-bg-sunken)] hover:border-[var(--color-border-strong)]"}`,
|
|
514
|
-
children: [/* @__PURE__ */
|
|
504
|
+
children: [/* @__PURE__ */ u(e.icon, { className: `w-5 h-5 ${e.disabled ? "opacity-50" : ""}` }), /* @__PURE__ */ u("span", {
|
|
515
505
|
className: `sr-only sm:not-sr-only text-sm font-medium transition-colors hidden sm:inline ${e.disabled ? "text-[var(--color-text-disabled)]" : "text-[var(--color-text-secondary)] group-hover:text-[var(--color-text-primary)]"}`,
|
|
516
506
|
children: e.name
|
|
517
507
|
})]
|
|
518
508
|
}, e.name))
|
|
519
509
|
}),
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
className: "mt-6",
|
|
522
|
-
children: /* @__PURE__ */ m("button", {
|
|
523
|
-
onClick: () => h("/auth/sso/login"),
|
|
524
|
-
className: "w-full flex items-center justify-center gap-3 px-4 py-3 rounded-xl border-2 border-dashed border-[var(--color-border-default)] hover:border-action-primary-bg bg-[var(--color-bg-surface)] hover:bg-status-info-bg-subtle transition-all duration-200 group",
|
|
525
|
-
children: [/* @__PURE__ */ p("svg", {
|
|
526
|
-
className: "w-5 h-5 text-[var(--color-text-tertiary)] group-hover:text-text-link",
|
|
527
|
-
fill: "none",
|
|
528
|
-
viewBox: "0 0 24 24",
|
|
529
|
-
stroke: "currentColor",
|
|
530
|
-
children: /* @__PURE__ */ p("path", {
|
|
531
|
-
strokeLinecap: "round",
|
|
532
|
-
strokeLinejoin: "round",
|
|
533
|
-
strokeWidth: 1.5,
|
|
534
|
-
d: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"
|
|
535
|
-
})
|
|
536
|
-
}), /* @__PURE__ */ p("span", {
|
|
537
|
-
className: "text-sm font-medium text-[var(--color-text-secondary)] group-hover:text-text-link",
|
|
538
|
-
children: y("auth.login.enterpriseSso", "Sign in with Enterprise SSO")
|
|
539
|
-
})]
|
|
540
|
-
})
|
|
541
|
-
}),
|
|
542
|
-
/* @__PURE__ */ p("div", {
|
|
510
|
+
/* @__PURE__ */ u("div", {
|
|
543
511
|
className: "mt-4 text-center",
|
|
544
|
-
children: /* @__PURE__ */
|
|
545
|
-
onClick: () =>
|
|
512
|
+
children: /* @__PURE__ */ d("button", {
|
|
513
|
+
onClick: () => f("/auth/magic-link"),
|
|
546
514
|
className: "text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] transition-colors",
|
|
547
515
|
children: [
|
|
548
|
-
|
|
516
|
+
g("auth.login.preferPasswordless", "Prefer passwordless login?"),
|
|
549
517
|
" ",
|
|
550
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ u("span", {
|
|
551
519
|
className: "font-semibold text-text-link hover:text-text-linkHover",
|
|
552
|
-
children:
|
|
520
|
+
children: g("auth.login.signInMagicLink", "Sign in with Magic Link")
|
|
553
521
|
})
|
|
554
522
|
]
|
|
555
523
|
})
|
|
556
524
|
}),
|
|
557
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ d("p", {
|
|
558
526
|
className: "mt-6 text-center text-sm text-[var(--color-text-secondary)]",
|
|
559
527
|
children: [
|
|
560
|
-
|
|
528
|
+
g("auth.login.dontHaveAccount", "Don't have an account?"),
|
|
561
529
|
" ",
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
onClick: () =>
|
|
530
|
+
/* @__PURE__ */ u("button", {
|
|
531
|
+
onClick: () => f("/auth/register"),
|
|
564
532
|
className: "font-semibold text-text-link hover:text-text-linkHover transition-colors",
|
|
565
|
-
children:
|
|
533
|
+
children: g("auth.login.signUp", "Sign up")
|
|
566
534
|
})
|
|
567
535
|
]
|
|
568
536
|
})
|
|
@@ -570,6 +538,6 @@ function h() {
|
|
|
570
538
|
});
|
|
571
539
|
}
|
|
572
540
|
//#endregion
|
|
573
|
-
export {
|
|
541
|
+
export { f as LoginPage };
|
|
574
542
|
|
|
575
543
|
//# sourceMappingURL=LoginPage.js.map
|