@bagelink/auth 1.6.53 → 1.6.57
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 +284 -219
- package/dist/Callback-BHqVaZZm.cjs +4 -0
- package/dist/Callback-C-XghN_z.js +4 -0
- package/dist/ForgotPasswordPage-BV9tyhHl.cjs +4 -0
- package/dist/ForgotPasswordPage-DvttMGb0.js +4 -0
- package/dist/LoginPage-hv1wc54S.cjs +4 -0
- package/dist/LoginPage-klj1NV4J.js +4 -0
- package/dist/ResetPasswordPage-COPrJmW8.cjs +4 -0
- package/dist/ResetPasswordPage-nvQ4uupb.js +4 -0
- package/dist/SignupPage-m36w9PLJ.cjs +4 -0
- package/dist/SignupPage-oUFYApYW.js +4 -0
- package/dist/api.d.ts +115 -0
- package/dist/components/auth/ForgotPasswordForm.vue.d.ts +23 -0
- package/dist/components/auth/LoginForm.vue.d.ts +58 -0
- package/dist/components/auth/ResetPasswordForm.vue.d.ts +28 -0
- package/dist/components/auth/SignupForm.vue.d.ts +34 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/constants.d.ts +34 -0
- package/dist/index.cjs +1227 -30
- package/dist/index.d.ts +16 -631
- package/dist/index.mjs +1242 -24
- package/dist/pages/Callback.vue.d.ts +2 -0
- package/dist/pages/ForgotPasswordPage.vue.d.ts +13 -0
- package/dist/pages/LoginPage.vue.d.ts +38 -0
- package/dist/pages/ResetPasswordPage.vue.d.ts +13 -0
- package/dist/pages/SignupPage.vue.d.ts +16 -0
- package/dist/routes.d.ts +49 -0
- package/dist/sso.d.ts +145 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types.d.ts +254 -0
- package/dist/useAuth.d.ts +112 -0
- package/dist/utils.d.ts +11 -0
- package/package.json +11 -13
- package/src/components/auth/ForgotPasswordForm.vue +97 -0
- package/src/components/auth/LoginForm.vue +257 -0
- package/src/components/auth/ResetPasswordForm.vue +146 -0
- package/src/components/auth/SignupForm.vue +224 -0
- package/src/components/index.ts +5 -0
- package/src/constants.ts +10 -0
- package/src/index.ts +26 -1
- package/src/pages/Callback.vue +183 -0
- package/src/pages/ForgotPasswordPage.vue +42 -0
- package/src/pages/LoginPage.vue +68 -0
- package/src/pages/ResetPasswordPage.vue +47 -0
- package/src/pages/SignupPage.vue +46 -0
- package/src/routes.ts +122 -0
- package/src/types/index.ts +45 -0
- package/dist/index.d.cts +0 -631
- package/dist/index.d.mts +0 -631
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { defineComponent, ref, computed, createElementBlock, openBlock, normalizeClass, createVNode, createElementVNode, unref, toDisplayString, withModifiers, resolveDirective, createCommentVNode, Fragment, createBlock, withDirectives, normalizeStyle, onMounted, withCtx, renderList } from "vue";
|
|
6
|
+
import { Icon, Btn, TextInput, PasswordInput, Card, Loading } from "@bagelink/vue";
|
|
7
|
+
import { useRoute, useRouter } from "vue-router";
|
|
4
8
|
function createAxiosInstance(baseURL) {
|
|
5
9
|
return axios.create({
|
|
6
10
|
baseURL,
|
|
@@ -11,7 +15,9 @@ function createAxiosInstance(baseURL) {
|
|
|
11
15
|
});
|
|
12
16
|
}
|
|
13
17
|
class EventEmitter {
|
|
14
|
-
|
|
18
|
+
constructor() {
|
|
19
|
+
__publicField(this, "listeners", /* @__PURE__ */ new Map());
|
|
20
|
+
}
|
|
15
21
|
on(event, handler) {
|
|
16
22
|
if (!this.listeners.has(event)) {
|
|
17
23
|
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
@@ -54,10 +60,9 @@ function queryParams() {
|
|
|
54
60
|
});
|
|
55
61
|
return result;
|
|
56
62
|
}
|
|
57
|
-
|
|
58
63
|
class AuthApi {
|
|
59
|
-
api;
|
|
60
64
|
constructor(baseURL = "") {
|
|
65
|
+
__publicField(this, "api");
|
|
61
66
|
this.api = createAxiosInstance(baseURL);
|
|
62
67
|
this.setupInterceptors();
|
|
63
68
|
}
|
|
@@ -275,10 +280,1182 @@ class AuthApi {
|
|
|
275
280
|
return this.api.post("/authentication/cleanup-sessions", {});
|
|
276
281
|
}
|
|
277
282
|
}
|
|
278
|
-
|
|
283
|
+
const _hoisted_1$8 = { class: "txt20 bold mb-1" };
|
|
284
|
+
const _hoisted_2$4 = { class: "txt-center opacity-7" };
|
|
285
|
+
const _hoisted_3$3 = { class: "txt20 bold txt-center mb-1" };
|
|
286
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
287
|
+
__name: "ForgotPasswordForm",
|
|
288
|
+
props: {
|
|
289
|
+
emailSent: { type: Boolean, default: false },
|
|
290
|
+
useHebrewDefaults: { type: Boolean, default: false },
|
|
291
|
+
texts: { default: () => ({}) }
|
|
292
|
+
},
|
|
293
|
+
emits: ["switchForm"],
|
|
294
|
+
setup(__props) {
|
|
295
|
+
const props = __props;
|
|
296
|
+
const { forgotPassword } = useAuth();
|
|
297
|
+
const email = ref("");
|
|
298
|
+
const internalEmailSent = ref(false);
|
|
299
|
+
const showEmailSent = computed(() => props.emailSent || internalEmailSent.value);
|
|
300
|
+
const texts = computed(() => {
|
|
301
|
+
var _a, _b, _c, _d, _e, _f;
|
|
302
|
+
const hebrewDefaults = {
|
|
303
|
+
title: "שכחתם סיסמה",
|
|
304
|
+
emailLabel: "איימיל",
|
|
305
|
+
submitButton: "שליחת איימיל איפוס",
|
|
306
|
+
backToLogin: "חזרה להתחברות",
|
|
307
|
+
emailSentTitle: "איימיל נשלח!",
|
|
308
|
+
emailSentMessage: "יש לבדוק את תיבת הדואר שלכם לקישור איפוס הסיסמה"
|
|
309
|
+
};
|
|
310
|
+
const englishDefaults = {
|
|
311
|
+
title: "Forgot Password",
|
|
312
|
+
emailLabel: "Email",
|
|
313
|
+
submitButton: "Send Reset Email",
|
|
314
|
+
backToLogin: "Back to Login",
|
|
315
|
+
emailSentTitle: "Email Sent!",
|
|
316
|
+
emailSentMessage: "Check your inbox for a password reset link"
|
|
317
|
+
};
|
|
318
|
+
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
319
|
+
return {
|
|
320
|
+
title: ((_a = props.texts) == null ? void 0 : _a.title) ?? defaults.title,
|
|
321
|
+
emailLabel: ((_b = props.texts) == null ? void 0 : _b.emailLabel) ?? defaults.emailLabel,
|
|
322
|
+
submitButton: ((_c = props.texts) == null ? void 0 : _c.submitButton) ?? defaults.submitButton,
|
|
323
|
+
backToLogin: ((_d = props.texts) == null ? void 0 : _d.backToLogin) ?? defaults.backToLogin,
|
|
324
|
+
emailSentTitle: ((_e = props.texts) == null ? void 0 : _e.emailSentTitle) ?? defaults.emailSentTitle,
|
|
325
|
+
emailSentMessage: ((_f = props.texts) == null ? void 0 : _f.emailSentMessage) ?? defaults.emailSentMessage
|
|
326
|
+
};
|
|
327
|
+
});
|
|
328
|
+
const textDirection = computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
329
|
+
async function handleRecoverPassword() {
|
|
330
|
+
await forgotPassword(email.value);
|
|
331
|
+
internalEmailSent.value = true;
|
|
332
|
+
}
|
|
333
|
+
return (_ctx, _cache) => {
|
|
334
|
+
return showEmailSent.value ? (openBlock(), createElementBlock("div", {
|
|
335
|
+
key: 0,
|
|
336
|
+
class: normalizeClass(["txt-center", [textDirection.value]])
|
|
337
|
+
}, [
|
|
338
|
+
createVNode(unref(Icon), {
|
|
339
|
+
name: "email",
|
|
340
|
+
size: "4",
|
|
341
|
+
class: "opacity-3 mb-1"
|
|
342
|
+
}),
|
|
343
|
+
createElementVNode("h1", _hoisted_1$8, toDisplayString(texts.value.emailSentTitle), 1),
|
|
344
|
+
createElementVNode("p", _hoisted_2$4, toDisplayString(texts.value.emailSentMessage), 1),
|
|
345
|
+
createVNode(unref(Btn), {
|
|
346
|
+
thin: "",
|
|
347
|
+
flat: "",
|
|
348
|
+
class: "txt-12 mt-2 underline",
|
|
349
|
+
value: texts.value.backToLogin,
|
|
350
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
351
|
+
}, null, 8, ["value"])
|
|
352
|
+
], 2)) : (openBlock(), createElementBlock("form", {
|
|
353
|
+
key: 1,
|
|
354
|
+
class: normalizeClass(textDirection.value),
|
|
355
|
+
onSubmit: withModifiers(handleRecoverPassword, ["prevent"])
|
|
356
|
+
}, [
|
|
357
|
+
createElementVNode("h1", _hoisted_3$3, toDisplayString(texts.value.title), 1),
|
|
358
|
+
createVNode(unref(TextInput), {
|
|
359
|
+
modelValue: email.value,
|
|
360
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => email.value = $event),
|
|
361
|
+
label: texts.value.emailLabel,
|
|
362
|
+
autocomplete: "email",
|
|
363
|
+
type: "email"
|
|
364
|
+
}, null, 8, ["modelValue", "label"]),
|
|
365
|
+
createVNode(unref(Btn), {
|
|
366
|
+
type: "submit",
|
|
367
|
+
class: "w-100 mt-05",
|
|
368
|
+
value: texts.value.submitButton
|
|
369
|
+
}, null, 8, ["value"]),
|
|
370
|
+
createVNode(unref(Btn), {
|
|
371
|
+
thin: "",
|
|
372
|
+
flat: "",
|
|
373
|
+
class: "txt-12 mt-075 underline block",
|
|
374
|
+
value: texts.value.backToLogin,
|
|
375
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
376
|
+
}, null, 8, ["value"])
|
|
377
|
+
], 34));
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
const _hoisted_1$7 = { class: "txt20 bold txt-center mb-1" };
|
|
382
|
+
const _hoisted_2$3 = { key: 1 };
|
|
383
|
+
const _hoisted_3$2 = {
|
|
384
|
+
key: 0,
|
|
385
|
+
class: "flex gap-1 opacity-6"
|
|
386
|
+
};
|
|
387
|
+
const _hoisted_4$2 = { class: "txt-center my-05" };
|
|
388
|
+
const _hoisted_5$2 = {
|
|
389
|
+
key: 2,
|
|
390
|
+
class: "txt-center color-red txt-12 mt-1"
|
|
391
|
+
};
|
|
392
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
393
|
+
__name: "LoginForm",
|
|
394
|
+
props: {
|
|
395
|
+
hideRegularLogin: { type: Boolean, default: false },
|
|
396
|
+
showForgotPassword: { type: Boolean, default: true },
|
|
397
|
+
showSignupButton: { type: Boolean, default: true },
|
|
398
|
+
github: { type: Boolean, default: true },
|
|
399
|
+
google: { type: Boolean, default: true },
|
|
400
|
+
microsoft: { type: Boolean, default: true },
|
|
401
|
+
apple: { type: Boolean, default: true },
|
|
402
|
+
okta: { type: Boolean, default: true },
|
|
403
|
+
facebook: { type: Boolean, default: true },
|
|
404
|
+
ssoOutline: { type: Boolean, default: true },
|
|
405
|
+
ssoShowValue: { type: Boolean, default: true },
|
|
406
|
+
ssoSize: { default: void 0 },
|
|
407
|
+
ssoAlign: { type: Boolean, default: false },
|
|
408
|
+
ssoBrandBackground: { type: Boolean, default: true },
|
|
409
|
+
useHebrewDefaults: { type: Boolean, default: false },
|
|
410
|
+
errorState: { default: "normal" },
|
|
411
|
+
texts: { default: () => ({}) }
|
|
412
|
+
},
|
|
413
|
+
emits: ["switchForm"],
|
|
414
|
+
setup(__props) {
|
|
415
|
+
const props = __props;
|
|
416
|
+
const { login, sso: sso2 } = useAuth();
|
|
417
|
+
const form = ref({
|
|
418
|
+
email: "",
|
|
419
|
+
password: ""
|
|
420
|
+
});
|
|
421
|
+
const internalError = ref("");
|
|
422
|
+
const texts = computed(() => {
|
|
423
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
424
|
+
const hebrewDefaults = {
|
|
425
|
+
title: "התחברות",
|
|
426
|
+
emailLabel: "אימייל",
|
|
427
|
+
passwordLabel: "סיסמה",
|
|
428
|
+
forgotPassword: "שכחתם סיסמה?",
|
|
429
|
+
loginButton: "התחברות",
|
|
430
|
+
signupButton: "יצירת חשבון",
|
|
431
|
+
orText: "או",
|
|
432
|
+
githubButton: "התחברות עם GitHub",
|
|
433
|
+
googleButton: "התחברות עם Google",
|
|
434
|
+
microsoftButton: "התחברות עם Microsoft",
|
|
435
|
+
appleButton: "התחברות עם Apple",
|
|
436
|
+
oktaButton: "התחברות עם Okta",
|
|
437
|
+
facebookButton: "התחברות עם Facebook"
|
|
438
|
+
};
|
|
439
|
+
const englishDefaults = {
|
|
440
|
+
title: "Login In",
|
|
441
|
+
emailLabel: "Email",
|
|
442
|
+
passwordLabel: "Password",
|
|
443
|
+
forgotPassword: "Forgot Password?",
|
|
444
|
+
loginButton: "Login In",
|
|
445
|
+
signupButton: "Create Account",
|
|
446
|
+
orText: "or",
|
|
447
|
+
githubButton: "Login with GitHub",
|
|
448
|
+
googleButton: "Login with Google",
|
|
449
|
+
microsoftButton: "Login with Microsoft",
|
|
450
|
+
appleButton: "Login with Apple",
|
|
451
|
+
oktaButton: "Login with Okta",
|
|
452
|
+
facebookButton: "Login with Facebook"
|
|
453
|
+
};
|
|
454
|
+
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
455
|
+
return {
|
|
456
|
+
title: ((_a = props.texts) == null ? void 0 : _a.title) ?? defaults.title,
|
|
457
|
+
emailLabel: ((_b = props.texts) == null ? void 0 : _b.emailLabel) ?? defaults.emailLabel,
|
|
458
|
+
passwordLabel: ((_c = props.texts) == null ? void 0 : _c.passwordLabel) ?? defaults.passwordLabel,
|
|
459
|
+
forgotPassword: ((_d = props.texts) == null ? void 0 : _d.forgotPassword) ?? defaults.forgotPassword,
|
|
460
|
+
loginButton: ((_e = props.texts) == null ? void 0 : _e.loginButton) ?? defaults.loginButton,
|
|
461
|
+
signupButton: ((_f = props.texts) == null ? void 0 : _f.signupButton) ?? defaults.signupButton,
|
|
462
|
+
orText: ((_g = props.texts) == null ? void 0 : _g.orText) ?? defaults.orText,
|
|
463
|
+
githubButton: ((_h = props.texts) == null ? void 0 : _h.githubButton) ?? defaults.githubButton,
|
|
464
|
+
googleButton: ((_i = props.texts) == null ? void 0 : _i.googleButton) ?? defaults.googleButton,
|
|
465
|
+
microsoftButton: ((_j = props.texts) == null ? void 0 : _j.microsoftButton) ?? defaults.microsoftButton,
|
|
466
|
+
appleButton: ((_k = props.texts) == null ? void 0 : _k.appleButton) ?? defaults.appleButton,
|
|
467
|
+
oktaButton: ((_l = props.texts) == null ? void 0 : _l.oktaButton) ?? defaults.oktaButton,
|
|
468
|
+
facebookButton: ((_m = props.texts) == null ? void 0 : _m.facebookButton) ?? defaults.facebookButton
|
|
469
|
+
};
|
|
470
|
+
});
|
|
471
|
+
const showAnySso = computed(
|
|
472
|
+
() => props.github || props.google || props.microsoft || props.apple || props.okta || props.facebook
|
|
473
|
+
);
|
|
474
|
+
const textDirection = computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
475
|
+
const error = computed(() => getDevError() || internalError.value);
|
|
476
|
+
function getDevError() {
|
|
477
|
+
switch (props.errorState) {
|
|
478
|
+
case "email-required":
|
|
479
|
+
return props.useHebrewDefaults ? "איימיל נדרש" : "Email is required";
|
|
480
|
+
case "email-invalid":
|
|
481
|
+
return props.useHebrewDefaults ? "יש להזין כתובת איימיל תקינה" : "Please enter a valid email address";
|
|
482
|
+
case "password-required":
|
|
483
|
+
return props.useHebrewDefaults ? "סיסמה נדרשת" : "Password is required";
|
|
484
|
+
case "invalid-credentials":
|
|
485
|
+
return props.useHebrewDefaults ? "איימיל או סיסמה לא נכונים" : "Invalid email or password";
|
|
486
|
+
case "server-error":
|
|
487
|
+
return props.useHebrewDefaults ? "ההתחברות נכשלה. אנא נסה שוב." : "Login failed. Please try again.";
|
|
488
|
+
default:
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
async function handleLogin() {
|
|
493
|
+
internalError.value = "";
|
|
494
|
+
if (props.errorState !== "normal") {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const { message } = await login(form.value);
|
|
498
|
+
internalError.value = message;
|
|
499
|
+
}
|
|
500
|
+
return (_ctx, _cache) => {
|
|
501
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
502
|
+
return openBlock(), createElementBlock("form", {
|
|
503
|
+
class: normalizeClass(textDirection.value),
|
|
504
|
+
onSubmit: withModifiers(handleLogin, ["prevent"])
|
|
505
|
+
}, [
|
|
506
|
+
createElementVNode("h1", _hoisted_1$7, toDisplayString(texts.value.title), 1),
|
|
507
|
+
!props.hideRegularLogin ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
508
|
+
createVNode(unref(TextInput), {
|
|
509
|
+
modelValue: form.value.email,
|
|
510
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value.email = $event),
|
|
511
|
+
type: "email",
|
|
512
|
+
label: texts.value.emailLabel,
|
|
513
|
+
autocomplete: "email"
|
|
514
|
+
}, null, 8, ["modelValue", "label"]),
|
|
515
|
+
createVNode(unref(PasswordInput), {
|
|
516
|
+
modelValue: form.value.password,
|
|
517
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.password = $event),
|
|
518
|
+
label: texts.value.passwordLabel
|
|
519
|
+
}, null, 8, ["modelValue", "label"]),
|
|
520
|
+
props.showForgotPassword ? (openBlock(), createBlock(unref(Btn), {
|
|
521
|
+
key: 0,
|
|
522
|
+
thin: "",
|
|
523
|
+
flat: "",
|
|
524
|
+
class: "txt-12 mt-075 underline block",
|
|
525
|
+
value: texts.value.forgotPassword,
|
|
526
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("switchForm", "forgot-password"))
|
|
527
|
+
}, null, 8, ["value"])) : createCommentVNode("", true),
|
|
528
|
+
createVNode(unref(Btn), {
|
|
529
|
+
type: "submit",
|
|
530
|
+
class: "w-100 mt-1",
|
|
531
|
+
value: texts.value.loginButton
|
|
532
|
+
}, null, 8, ["value"]),
|
|
533
|
+
props.showSignupButton ? (openBlock(), createBlock(unref(Btn), {
|
|
534
|
+
key: 1,
|
|
535
|
+
outline: "",
|
|
536
|
+
color: "primary",
|
|
537
|
+
class: "w-100 mt-05",
|
|
538
|
+
value: texts.value.signupButton,
|
|
539
|
+
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("switchForm", "signup"))
|
|
540
|
+
}, null, 8, ["value"])) : createCommentVNode("", true)
|
|
541
|
+
], 64)) : createCommentVNode("", true),
|
|
542
|
+
showAnySso.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
|
|
543
|
+
!props.hideRegularLogin ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
|
|
544
|
+
_cache[10] || (_cache[10] = createElementVNode("div", { class: "line" }, null, -1)),
|
|
545
|
+
createElementVNode("p", _hoisted_4$2, toDisplayString(texts.value.orText), 1),
|
|
546
|
+
_cache[11] || (_cache[11] = createElementVNode("div", { class: "line" }, null, -1))
|
|
547
|
+
])) : createCommentVNode("", true),
|
|
548
|
+
createElementVNode("div", {
|
|
549
|
+
class: normalizeClass(["gap-05", { "grid grid-wrap-1": props.ssoShowValue, "flex justify-content-center gap-05 flex-wrap": !props.ssoShowValue }])
|
|
550
|
+
}, [
|
|
551
|
+
props.github ? withDirectives((openBlock(), createBlock(unref(Btn), {
|
|
552
|
+
key: 0,
|
|
553
|
+
outline: props.ssoOutline,
|
|
554
|
+
"full-width": props.ssoAlign,
|
|
555
|
+
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
556
|
+
style: normalizeStyle(props.ssoOutline ? "color: #24292F;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #24292F;" : ""}`),
|
|
557
|
+
icon: "github",
|
|
558
|
+
class: normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
559
|
+
value: props.ssoShowValue ? texts.value.githubButton : void 0,
|
|
560
|
+
size: props.ssoSize,
|
|
561
|
+
onClick: _cache[4] || (_cache[4] = ($event) => unref(sso2).github.redirect())
|
|
562
|
+
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
563
|
+
[_directive_tooltip, !props.ssoShowValue ? texts.value.githubButton : void 0]
|
|
564
|
+
]) : createCommentVNode("", true),
|
|
565
|
+
props.google ? withDirectives((openBlock(), createBlock(unref(Btn), {
|
|
566
|
+
key: 1,
|
|
567
|
+
outline: props.ssoOutline,
|
|
568
|
+
"full-width": props.ssoAlign,
|
|
569
|
+
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
570
|
+
style: normalizeStyle(props.ssoOutline ? "color: #DB4437;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #DB4437;" : ""}`),
|
|
571
|
+
icon: "google",
|
|
572
|
+
class: normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
573
|
+
value: props.ssoShowValue ? texts.value.googleButton : void 0,
|
|
574
|
+
size: props.ssoSize,
|
|
575
|
+
onClick: _cache[5] || (_cache[5] = ($event) => unref(sso2).google.redirect())
|
|
576
|
+
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
577
|
+
[_directive_tooltip, !props.ssoShowValue ? texts.value.googleButton : void 0]
|
|
578
|
+
]) : createCommentVNode("", true),
|
|
579
|
+
props.microsoft ? withDirectives((openBlock(), createBlock(unref(Btn), {
|
|
580
|
+
key: 2,
|
|
581
|
+
outline: props.ssoOutline,
|
|
582
|
+
"full-width": props.ssoAlign,
|
|
583
|
+
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
584
|
+
style: normalizeStyle(props.ssoOutline ? "color: #2F2FEE;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #2F2FEE;" : ""}`),
|
|
585
|
+
icon: "microsoft",
|
|
586
|
+
class: normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
587
|
+
value: props.ssoShowValue ? texts.value.microsoftButton : void 0,
|
|
588
|
+
size: props.ssoSize,
|
|
589
|
+
onClick: _cache[6] || (_cache[6] = ($event) => unref(sso2).microsoft.redirect())
|
|
590
|
+
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
591
|
+
[_directive_tooltip, !props.ssoShowValue ? texts.value.microsoftButton : void 0]
|
|
592
|
+
]) : createCommentVNode("", true),
|
|
593
|
+
props.apple ? withDirectives((openBlock(), createBlock(unref(Btn), {
|
|
594
|
+
key: 3,
|
|
595
|
+
outline: props.ssoOutline,
|
|
596
|
+
"full-width": props.ssoAlign,
|
|
597
|
+
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
598
|
+
style: normalizeStyle(props.ssoOutline ? "color: #000000;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #000000;" : ""}`),
|
|
599
|
+
icon: "apple",
|
|
600
|
+
class: normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
601
|
+
value: props.ssoShowValue ? texts.value.appleButton : void 0,
|
|
602
|
+
size: props.ssoSize,
|
|
603
|
+
onClick: _cache[7] || (_cache[7] = ($event) => unref(sso2).apple.redirect())
|
|
604
|
+
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
605
|
+
[_directive_tooltip, !props.ssoShowValue ? texts.value.appleButton : void 0]
|
|
606
|
+
]) : createCommentVNode("", true),
|
|
607
|
+
props.okta ? withDirectives((openBlock(), createBlock(unref(Btn), {
|
|
608
|
+
key: 4,
|
|
609
|
+
outline: props.ssoOutline,
|
|
610
|
+
"full-width": props.ssoAlign,
|
|
611
|
+
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
612
|
+
style: normalizeStyle(props.ssoOutline ? "color: #FFB600;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #FFB600;" : ""}`),
|
|
613
|
+
icon: "sun",
|
|
614
|
+
class: normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
615
|
+
value: props.ssoShowValue ? texts.value.oktaButton : void 0,
|
|
616
|
+
size: props.ssoSize,
|
|
617
|
+
onClick: _cache[8] || (_cache[8] = ($event) => unref(sso2).okta.redirect())
|
|
618
|
+
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
619
|
+
[_directive_tooltip, !props.ssoShowValue ? texts.value.oktaButton : void 0]
|
|
620
|
+
]) : createCommentVNode("", true),
|
|
621
|
+
props.facebook ? withDirectives((openBlock(), createBlock(unref(Btn), {
|
|
622
|
+
key: 5,
|
|
623
|
+
outline: props.ssoOutline,
|
|
624
|
+
"full-width": props.ssoAlign,
|
|
625
|
+
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
626
|
+
style: normalizeStyle(props.ssoOutline ? "color: #1877F3;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #1877F3;" : ""}`),
|
|
627
|
+
icon: "facebook",
|
|
628
|
+
class: normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
629
|
+
value: props.ssoShowValue ? texts.value.facebookButton : void 0,
|
|
630
|
+
size: props.ssoSize,
|
|
631
|
+
onClick: _cache[9] || (_cache[9] = ($event) => unref(sso2).facebook.redirect())
|
|
632
|
+
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
633
|
+
[_directive_tooltip, !props.ssoShowValue ? texts.value.facebookButton : void 0]
|
|
634
|
+
]) : createCommentVNode("", true)
|
|
635
|
+
], 2)
|
|
636
|
+
])) : createCommentVNode("", true),
|
|
637
|
+
error.value ? (openBlock(), createElementBlock("p", _hoisted_5$2, toDisplayString(error.value), 1)) : createCommentVNode("", true)
|
|
638
|
+
], 34);
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
const _hoisted_1$6 = { class: "txt20 bold mb-1" };
|
|
643
|
+
const _hoisted_2$2 = { class: "opacity-7 mb-2" };
|
|
644
|
+
const _hoisted_3$1 = { class: "txt20 bold mb-1" };
|
|
645
|
+
const _hoisted_4$1 = { class: "opacity-7 mb-2" };
|
|
646
|
+
const _hoisted_5$1 = { class: "txt20 bold txt-center mb-1" };
|
|
647
|
+
const _hoisted_6$1 = ["textContent"];
|
|
648
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
649
|
+
__name: "ResetPasswordForm",
|
|
650
|
+
props: {
|
|
651
|
+
token: {},
|
|
652
|
+
showSuccess: { type: Boolean },
|
|
653
|
+
useHebrewDefaults: { type: Boolean, default: false },
|
|
654
|
+
texts: {}
|
|
655
|
+
},
|
|
656
|
+
emits: ["switchForm"],
|
|
657
|
+
setup(__props) {
|
|
658
|
+
const props = __props;
|
|
659
|
+
const { resetPassword } = useAuth();
|
|
660
|
+
const error = ref("");
|
|
661
|
+
const internalSuccess = ref(false);
|
|
662
|
+
const newPassword = ref("");
|
|
663
|
+
const confirmPassword = ref("");
|
|
664
|
+
const isValidToken = computed(() => !!props.token);
|
|
665
|
+
const isSuccess = computed(() => props.showSuccess || internalSuccess.value);
|
|
666
|
+
const texts = computed(() => {
|
|
667
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
668
|
+
const hebrewDefaults = {
|
|
669
|
+
title: "איפוס סיסמה",
|
|
670
|
+
invalidLinkTitle: "קישור לא תקין",
|
|
671
|
+
invalidLinkMessage: "קישור איפוס הסיסמה לא תקין או פג תוקף",
|
|
672
|
+
newPasswordLabel: "סיסמה חדשה",
|
|
673
|
+
confirmPasswordLabel: "אימות סיסמה",
|
|
674
|
+
submitButton: "איפוס סיסמה",
|
|
675
|
+
backToLogin: "חזרה להתחברות",
|
|
676
|
+
passwordMismatchError: "הסיסמאות לא תואמות",
|
|
677
|
+
invalidTokenError: "אסימון לא תקין",
|
|
678
|
+
successTitle: "הסיסמה אופסה בהצלחה!",
|
|
679
|
+
successMessage: "הסיסמה שלכם אופסה. כעת תוכלו להתחברות עם הסיסמה החדשה.",
|
|
680
|
+
goToLogin: "מעבר להתחברות"
|
|
681
|
+
};
|
|
682
|
+
const englishDefaults = {
|
|
683
|
+
title: "Reset Password",
|
|
684
|
+
invalidLinkTitle: "Invalid Link",
|
|
685
|
+
invalidLinkMessage: "This reset link is invalid or has expired",
|
|
686
|
+
newPasswordLabel: "New Password",
|
|
687
|
+
confirmPasswordLabel: "Confirm Password",
|
|
688
|
+
submitButton: "Reset Password",
|
|
689
|
+
backToLogin: "Back to Login",
|
|
690
|
+
passwordMismatchError: "Passwords do not match",
|
|
691
|
+
invalidTokenError: "Invalid token",
|
|
692
|
+
successTitle: "Password Reset Successfully!",
|
|
693
|
+
successMessage: "Your password has been reset. You can now log in with your new password.",
|
|
694
|
+
goToLogin: "Go to Login"
|
|
695
|
+
};
|
|
696
|
+
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
697
|
+
return {
|
|
698
|
+
title: ((_a = props.texts) == null ? void 0 : _a.title) ?? defaults.title,
|
|
699
|
+
invalidLinkTitle: ((_b = props.texts) == null ? void 0 : _b.invalidLinkTitle) ?? defaults.invalidLinkTitle,
|
|
700
|
+
invalidLinkMessage: ((_c = props.texts) == null ? void 0 : _c.invalidLinkMessage) ?? defaults.invalidLinkMessage,
|
|
701
|
+
newPasswordLabel: ((_d = props.texts) == null ? void 0 : _d.newPasswordLabel) ?? defaults.newPasswordLabel,
|
|
702
|
+
confirmPasswordLabel: ((_e = props.texts) == null ? void 0 : _e.confirmPasswordLabel) ?? defaults.confirmPasswordLabel,
|
|
703
|
+
submitButton: ((_f = props.texts) == null ? void 0 : _f.submitButton) ?? defaults.submitButton,
|
|
704
|
+
backToLogin: ((_g = props.texts) == null ? void 0 : _g.backToLogin) ?? defaults.backToLogin,
|
|
705
|
+
passwordMismatchError: ((_h = props.texts) == null ? void 0 : _h.passwordMismatchError) ?? defaults.passwordMismatchError,
|
|
706
|
+
invalidTokenError: ((_i = props.texts) == null ? void 0 : _i.invalidTokenError) ?? defaults.invalidTokenError,
|
|
707
|
+
successTitle: ((_j = props.texts) == null ? void 0 : _j.successTitle) ?? defaults.successTitle,
|
|
708
|
+
successMessage: ((_k = props.texts) == null ? void 0 : _k.successMessage) ?? defaults.successMessage,
|
|
709
|
+
goToLogin: ((_l = props.texts) == null ? void 0 : _l.goToLogin) ?? defaults.goToLogin
|
|
710
|
+
};
|
|
711
|
+
});
|
|
712
|
+
const textDirection = computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
713
|
+
async function handleResetPassword() {
|
|
714
|
+
if (newPassword.value !== confirmPassword.value) {
|
|
715
|
+
error.value = texts.value.passwordMismatchError;
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
if (!props.token) {
|
|
719
|
+
error.value = texts.value.invalidTokenError;
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
try {
|
|
723
|
+
await resetPassword(props.token, newPassword.value);
|
|
724
|
+
internalSuccess.value = true;
|
|
725
|
+
error.value = "";
|
|
726
|
+
} catch (err) {
|
|
727
|
+
error.value = err instanceof Error ? err.message : "Reset failed";
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return (_ctx, _cache) => {
|
|
731
|
+
return !isValidToken.value ? (openBlock(), createElementBlock("div", {
|
|
732
|
+
key: 0,
|
|
733
|
+
class: normalizeClass(["txt-center", textDirection.value])
|
|
734
|
+
}, [
|
|
735
|
+
createElementVNode("h1", _hoisted_1$6, toDisplayString(texts.value.invalidLinkTitle), 1),
|
|
736
|
+
createElementVNode("p", _hoisted_2$2, toDisplayString(texts.value.invalidLinkMessage), 1),
|
|
737
|
+
createVNode(unref(Btn), {
|
|
738
|
+
value: texts.value.backToLogin,
|
|
739
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
740
|
+
}, null, 8, ["value"])
|
|
741
|
+
], 2)) : isSuccess.value ? (openBlock(), createElementBlock("div", {
|
|
742
|
+
key: 1,
|
|
743
|
+
class: normalizeClass(["txt-center", textDirection.value])
|
|
744
|
+
}, [
|
|
745
|
+
createVNode(unref(Icon), {
|
|
746
|
+
name: "check_circle",
|
|
747
|
+
size: "4",
|
|
748
|
+
class: "txt-green mb-1"
|
|
749
|
+
}),
|
|
750
|
+
createElementVNode("h1", _hoisted_3$1, toDisplayString(texts.value.successTitle), 1),
|
|
751
|
+
createElementVNode("p", _hoisted_4$1, toDisplayString(texts.value.successMessage), 1),
|
|
752
|
+
createVNode(unref(Btn), {
|
|
753
|
+
value: texts.value.goToLogin,
|
|
754
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
755
|
+
}, null, 8, ["value"])
|
|
756
|
+
], 2)) : (openBlock(), createElementBlock("form", {
|
|
757
|
+
key: 2,
|
|
758
|
+
class: normalizeClass(textDirection.value),
|
|
759
|
+
onSubmit: withModifiers(handleResetPassword, ["prevent"])
|
|
760
|
+
}, [
|
|
761
|
+
createElementVNode("h1", _hoisted_5$1, toDisplayString(texts.value.title), 1),
|
|
762
|
+
createVNode(unref(PasswordInput), {
|
|
763
|
+
modelValue: newPassword.value,
|
|
764
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => newPassword.value = $event),
|
|
765
|
+
class: "mb-05",
|
|
766
|
+
label: texts.value.newPasswordLabel,
|
|
767
|
+
autocomplete: "new-password"
|
|
768
|
+
}, null, 8, ["modelValue", "label"]),
|
|
769
|
+
createVNode(unref(PasswordInput), {
|
|
770
|
+
modelValue: confirmPassword.value,
|
|
771
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => confirmPassword.value = $event),
|
|
772
|
+
label: texts.value.confirmPasswordLabel,
|
|
773
|
+
autocomplete: "new-password"
|
|
774
|
+
}, null, 8, ["modelValue", "label"]),
|
|
775
|
+
createVNode(unref(Btn), {
|
|
776
|
+
type: "submit",
|
|
777
|
+
class: "w-100 mt-2",
|
|
778
|
+
value: texts.value.submitButton
|
|
779
|
+
}, null, 8, ["value"]),
|
|
780
|
+
createVNode(unref(Btn), {
|
|
781
|
+
thin: "",
|
|
782
|
+
flat: "",
|
|
783
|
+
class: "txt-12 mt-075 underline block",
|
|
784
|
+
value: texts.value.backToLogin,
|
|
785
|
+
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
786
|
+
}, null, 8, ["value"]),
|
|
787
|
+
error.value ? (openBlock(), createElementBlock("p", {
|
|
788
|
+
key: 0,
|
|
789
|
+
class: "txt-center color-red txt-12 mt-1",
|
|
790
|
+
textContent: toDisplayString(error.value)
|
|
791
|
+
}, null, 8, _hoisted_6$1)) : createCommentVNode("", true)
|
|
792
|
+
], 34));
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
const _hoisted_1$5 = { class: "txt20 bold txt-center mb-1" };
|
|
797
|
+
const _hoisted_2$1 = ["textContent"];
|
|
798
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
799
|
+
__name: "SignupForm",
|
|
800
|
+
props: {
|
|
801
|
+
showNames: { type: Boolean, default: true },
|
|
802
|
+
useHebrewDefaults: { type: Boolean, default: false },
|
|
803
|
+
errorState: { default: "normal" },
|
|
804
|
+
texts: { default: () => ({}) }
|
|
805
|
+
},
|
|
806
|
+
emits: ["switchForm"],
|
|
807
|
+
setup(__props) {
|
|
808
|
+
const props = __props;
|
|
809
|
+
const { signup, login } = useAuth();
|
|
810
|
+
const internalError = ref("");
|
|
811
|
+
const error = computed(() => {
|
|
812
|
+
if (props.errorState !== "normal") {
|
|
813
|
+
return getDevError();
|
|
814
|
+
}
|
|
815
|
+
return internalError.value;
|
|
816
|
+
});
|
|
817
|
+
const form = ref({
|
|
818
|
+
email: "",
|
|
819
|
+
password: "",
|
|
820
|
+
confirmPassword: "",
|
|
821
|
+
first_name: "",
|
|
822
|
+
last_name: ""
|
|
823
|
+
});
|
|
824
|
+
const texts = computed(() => {
|
|
825
|
+
const hebrewDefaults = {
|
|
826
|
+
title: "יצירת חשבון",
|
|
827
|
+
firstNameLabel: "שם פרטי",
|
|
828
|
+
lastNameLabel: "שם משפחה",
|
|
829
|
+
emailLabel: "איימיל",
|
|
830
|
+
passwordLabel: "סיסמה",
|
|
831
|
+
confirmPasswordLabel: "אימות סיסמה",
|
|
832
|
+
signupButton: "יצירת חשבון",
|
|
833
|
+
alreadyHaveAccount: "יש לך כבר חשבון?",
|
|
834
|
+
// Validation errors
|
|
835
|
+
emailRequiredError: "איימיל נדרש",
|
|
836
|
+
emailInvalidError: "יש להזין כתובת איימיל תקינה",
|
|
837
|
+
passwordRequiredError: "סיסמה נדרשת",
|
|
838
|
+
passwordTooShortError: "הסיסמה חייבת להיות לפחות 8 תווים",
|
|
839
|
+
passwordMismatchError: "הסיסמאות לא תואמות",
|
|
840
|
+
firstNameRequiredError: "שם פרטי נדרש",
|
|
841
|
+
lastNameRequiredError: "שם משפחה נדרש"
|
|
842
|
+
};
|
|
843
|
+
const englishDefaults = {
|
|
844
|
+
title: "Create Account",
|
|
845
|
+
firstNameLabel: "First Name",
|
|
846
|
+
lastNameLabel: "Last Name",
|
|
847
|
+
emailLabel: "Email",
|
|
848
|
+
passwordLabel: "Password",
|
|
849
|
+
confirmPasswordLabel: "Confirm Password",
|
|
850
|
+
signupButton: "Create Account",
|
|
851
|
+
alreadyHaveAccount: "Already have an account?",
|
|
852
|
+
// Validation errors
|
|
853
|
+
emailRequiredError: "Email is required",
|
|
854
|
+
emailInvalidError: "Please enter a valid email address",
|
|
855
|
+
passwordRequiredError: "Password is required",
|
|
856
|
+
passwordTooShortError: "Password must be at least 8 characters",
|
|
857
|
+
passwordMismatchError: "Passwords do not match",
|
|
858
|
+
firstNameRequiredError: "First name is required",
|
|
859
|
+
lastNameRequiredError: "Last name is required"
|
|
860
|
+
};
|
|
861
|
+
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
862
|
+
return {
|
|
863
|
+
title: props.texts.title || defaults.title,
|
|
864
|
+
firstNameLabel: props.texts.firstNameLabel || defaults.firstNameLabel,
|
|
865
|
+
lastNameLabel: props.texts.lastNameLabel || defaults.lastNameLabel,
|
|
866
|
+
emailLabel: props.texts.emailLabel || defaults.emailLabel,
|
|
867
|
+
passwordLabel: props.texts.passwordLabel || defaults.passwordLabel,
|
|
868
|
+
confirmPasswordLabel: props.texts.confirmPasswordLabel || defaults.confirmPasswordLabel,
|
|
869
|
+
signupButton: props.texts.signupButton || defaults.signupButton,
|
|
870
|
+
alreadyHaveAccount: props.texts.alreadyHaveAccount || defaults.alreadyHaveAccount,
|
|
871
|
+
// Validation errors
|
|
872
|
+
emailRequiredError: props.texts.emailRequiredError || defaults.emailRequiredError,
|
|
873
|
+
emailInvalidError: props.texts.emailInvalidError || defaults.emailInvalidError,
|
|
874
|
+
passwordRequiredError: props.texts.passwordRequiredError || defaults.passwordRequiredError,
|
|
875
|
+
passwordTooShortError: props.texts.passwordTooShortError || defaults.passwordTooShortError,
|
|
876
|
+
passwordMismatchError: props.texts.passwordMismatchError || defaults.passwordMismatchError,
|
|
877
|
+
firstNameRequiredError: props.texts.firstNameRequiredError || defaults.firstNameRequiredError,
|
|
878
|
+
lastNameRequiredError: props.texts.lastNameRequiredError || defaults.lastNameRequiredError
|
|
879
|
+
};
|
|
880
|
+
});
|
|
881
|
+
const textDirection = computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
882
|
+
function getDevError() {
|
|
883
|
+
switch (props.errorState) {
|
|
884
|
+
case "email-required":
|
|
885
|
+
return texts.value.emailRequiredError;
|
|
886
|
+
case "email-invalid":
|
|
887
|
+
return texts.value.emailInvalidError;
|
|
888
|
+
case "password-short":
|
|
889
|
+
return texts.value.passwordTooShortError;
|
|
890
|
+
case "password-mismatch":
|
|
891
|
+
return texts.value.passwordMismatchError;
|
|
892
|
+
case "name-required":
|
|
893
|
+
return props.showNames ? texts.value.firstNameRequiredError : null;
|
|
894
|
+
case "server-error":
|
|
895
|
+
return props.useHebrewDefaults ? "כתובת האימייל כבר קיימת או שגיאת שרת" : "Email already exists or server error";
|
|
896
|
+
default:
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
function validateForm() {
|
|
901
|
+
if (!form.value.email.trim()) {
|
|
902
|
+
return texts.value.emailRequiredError;
|
|
903
|
+
}
|
|
904
|
+
const emailRegex = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
|
|
905
|
+
if (!emailRegex.test(form.value.email)) {
|
|
906
|
+
return texts.value.emailInvalidError;
|
|
907
|
+
}
|
|
908
|
+
if (!form.value.password) {
|
|
909
|
+
return texts.value.passwordRequiredError;
|
|
910
|
+
}
|
|
911
|
+
if (form.value.password.length < 8) {
|
|
912
|
+
return texts.value.passwordTooShortError;
|
|
913
|
+
}
|
|
914
|
+
if (form.value.password !== form.value.confirmPassword) {
|
|
915
|
+
return texts.value.passwordMismatchError;
|
|
916
|
+
}
|
|
917
|
+
if (props.showNames) {
|
|
918
|
+
if (!form.value.first_name.trim()) {
|
|
919
|
+
return texts.value.firstNameRequiredError;
|
|
920
|
+
}
|
|
921
|
+
if (!form.value.last_name.trim()) {
|
|
922
|
+
return texts.value.lastNameRequiredError;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
return null;
|
|
926
|
+
}
|
|
927
|
+
async function handleSignup() {
|
|
928
|
+
if (props.errorState !== "normal") {
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
internalError.value = "";
|
|
932
|
+
const validationError = validateForm();
|
|
933
|
+
if (validationError) {
|
|
934
|
+
internalError.value = validationError;
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
const { message, success } = await signup(form.value).catch((error2) => {
|
|
938
|
+
var _a, _b;
|
|
939
|
+
console.error(error2);
|
|
940
|
+
const errorMessage = (_b = (_a = error2.response) == null ? void 0 : _a.data) == null ? void 0 : _b.detail;
|
|
941
|
+
if (errorMessage == null ? void 0 : errorMessage.toLowerCase().includes("email")) {
|
|
942
|
+
return { success: false, message: "Email already exists or invalid" };
|
|
943
|
+
}
|
|
944
|
+
if (errorMessage == null ? void 0 : errorMessage.toLowerCase().includes("password")) {
|
|
945
|
+
return { success: false, message: "Password does not meet requirements" };
|
|
946
|
+
}
|
|
947
|
+
return { success: false, message: errorMessage || "Registration failed. Please try again." };
|
|
948
|
+
});
|
|
949
|
+
if (!success) {
|
|
950
|
+
internalError.value = message;
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
await login({ email: form.value.email, password: form.value.password });
|
|
954
|
+
}
|
|
955
|
+
return (_ctx, _cache) => {
|
|
956
|
+
return openBlock(), createElementBlock("form", {
|
|
957
|
+
class: normalizeClass(textDirection.value),
|
|
958
|
+
onSubmit: withModifiers(handleSignup, ["prevent"])
|
|
959
|
+
}, [
|
|
960
|
+
createElementVNode("h1", _hoisted_1$5, toDisplayString(texts.value.title), 1),
|
|
961
|
+
props.showNames ? (openBlock(), createBlock(unref(TextInput), {
|
|
962
|
+
key: 0,
|
|
963
|
+
modelValue: form.value.first_name,
|
|
964
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value.first_name = $event),
|
|
965
|
+
label: texts.value.firstNameLabel
|
|
966
|
+
}, null, 8, ["modelValue", "label"])) : createCommentVNode("", true),
|
|
967
|
+
props.showNames ? (openBlock(), createBlock(unref(TextInput), {
|
|
968
|
+
key: 1,
|
|
969
|
+
modelValue: form.value.last_name,
|
|
970
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.last_name = $event),
|
|
971
|
+
label: texts.value.lastNameLabel
|
|
972
|
+
}, null, 8, ["modelValue", "label"])) : createCommentVNode("", true),
|
|
973
|
+
createVNode(unref(TextInput), {
|
|
974
|
+
modelValue: form.value.email,
|
|
975
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => form.value.email = $event),
|
|
976
|
+
type: "email",
|
|
977
|
+
label: texts.value.emailLabel,
|
|
978
|
+
autocomplete: "username"
|
|
979
|
+
}, null, 8, ["modelValue", "label"]),
|
|
980
|
+
createVNode(unref(PasswordInput), {
|
|
981
|
+
modelValue: form.value.password,
|
|
982
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => form.value.password = $event),
|
|
983
|
+
class: "mb-05",
|
|
984
|
+
label: texts.value.passwordLabel
|
|
985
|
+
}, null, 8, ["modelValue", "label"]),
|
|
986
|
+
createVNode(unref(PasswordInput), {
|
|
987
|
+
modelValue: form.value.confirmPassword,
|
|
988
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => form.value.confirmPassword = $event),
|
|
989
|
+
label: texts.value.confirmPasswordLabel
|
|
990
|
+
}, null, 8, ["modelValue", "label"]),
|
|
991
|
+
createVNode(unref(Btn), {
|
|
992
|
+
class: "w-100 mt-2",
|
|
993
|
+
value: texts.value.signupButton,
|
|
994
|
+
type: "submit"
|
|
995
|
+
}, null, 8, ["value"]),
|
|
996
|
+
createVNode(unref(Btn), {
|
|
997
|
+
thin: "",
|
|
998
|
+
flat: "",
|
|
999
|
+
class: "txt-12 mt-075 underline block",
|
|
1000
|
+
value: texts.value.alreadyHaveAccount,
|
|
1001
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
1002
|
+
}, null, 8, ["value"]),
|
|
1003
|
+
error.value ? (openBlock(), createElementBlock("p", {
|
|
1004
|
+
key: 2,
|
|
1005
|
+
class: "txt-center color-red txt-12 mt-1",
|
|
1006
|
+
textContent: toDisplayString(error.value)
|
|
1007
|
+
}, null, 8, _hoisted_2$1)) : createCommentVNode("", true)
|
|
1008
|
+
], 34);
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
const INTAKE_WORKFLOW_ID = "fdba1933-0964-4850-b52a-7a4324175790";
|
|
1013
|
+
const DEFAULT_AGENT_ID = "fdba1933-0964-4850-b52a-7a4324175790";
|
|
1014
|
+
const providers = {
|
|
1015
|
+
github: { name: "GitHub", icon: "github", color: "#24292F" },
|
|
1016
|
+
google: { name: "Google", icon: "google", color: "#DB4437" },
|
|
1017
|
+
microsoft: { name: "Microsoft", icon: "microsoft", color: "#00A4EF" },
|
|
1018
|
+
apple: { name: "Apple", icon: "apple", color: "#000000" },
|
|
1019
|
+
okta: { name: "Okta", icon: "sun", color: "#FFB600" },
|
|
1020
|
+
facebook: { name: "Facebook", icon: "facebook", color: "#1877F3" }
|
|
1021
|
+
};
|
|
1022
|
+
const _hoisted_1$4 = { class: "flex justify-content-center align-items-center vh-100 px-1" };
|
|
1023
|
+
const _hoisted_2 = {
|
|
1024
|
+
key: 0,
|
|
1025
|
+
class: "flex column align-items-center gap-1"
|
|
1026
|
+
};
|
|
1027
|
+
const _hoisted_3 = { class: "mt-1" };
|
|
1028
|
+
const _hoisted_4 = { class: "mb-05 pb-0 mt-0 txt24 m_txt20" };
|
|
1029
|
+
const _hoisted_5 = { class: "opacity-7 txt-14" };
|
|
1030
|
+
const _hoisted_6 = {
|
|
1031
|
+
key: 1,
|
|
1032
|
+
class: "flex column align-items-center gap-1"
|
|
1033
|
+
};
|
|
1034
|
+
const _hoisted_7 = { class: "flex justify-content-center align-items-center mb-1" };
|
|
1035
|
+
const _hoisted_8 = { class: "relative" };
|
|
1036
|
+
const _hoisted_9 = {
|
|
1037
|
+
key: 0,
|
|
1038
|
+
class: "absolute flex justify-content-center align-items-center bg-white rounded",
|
|
1039
|
+
style: { "bottom": "-8px", "right": "-8px", "width": "40px", "height": "40px", "border": "3px solid white" }
|
|
1040
|
+
};
|
|
1041
|
+
const _hoisted_10 = { class: "mb-05 pb-0 mt-0 txt24 m_txt20" };
|
|
1042
|
+
const _hoisted_11 = { class: "opacity-7 txt-14 mb-1" };
|
|
1043
|
+
const _hoisted_12 = {
|
|
1044
|
+
key: 0,
|
|
1045
|
+
class: "bg-gray-light rounded p-1 mt-1"
|
|
1046
|
+
};
|
|
1047
|
+
const _hoisted_13 = { class: "flex column gap-05" };
|
|
1048
|
+
const _hoisted_14 = {
|
|
1049
|
+
key: 0,
|
|
1050
|
+
class: "flex align-items-center gap-05 justify-content-center"
|
|
1051
|
+
};
|
|
1052
|
+
const _hoisted_15 = { class: "txt-14 bold" };
|
|
1053
|
+
const _hoisted_16 = {
|
|
1054
|
+
key: 1,
|
|
1055
|
+
class: "flex align-items-center gap-05 justify-content-center"
|
|
1056
|
+
};
|
|
1057
|
+
const _hoisted_17 = { class: "txt-14 opacity-7" };
|
|
1058
|
+
const _hoisted_18 = {
|
|
1059
|
+
key: 2,
|
|
1060
|
+
class: "flex gap-05 justify-content-center mt-05"
|
|
1061
|
+
};
|
|
1062
|
+
const _hoisted_19 = {
|
|
1063
|
+
key: 2,
|
|
1064
|
+
class: "flex column align-items-center gap-1"
|
|
1065
|
+
};
|
|
1066
|
+
const _hoisted_20 = { class: "opacity-7 txt-14 mb-1" };
|
|
1067
|
+
const _hoisted_21 = { class: "flex gap-05 justify-content-center" };
|
|
1068
|
+
const timeout = 4e3;
|
|
1069
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1070
|
+
__name: "Callback",
|
|
1071
|
+
setup(__props) {
|
|
1072
|
+
const isLoading = ref(true);
|
|
1073
|
+
const error = ref(null);
|
|
1074
|
+
const success = ref(false);
|
|
1075
|
+
const isLinking = ref(false);
|
|
1076
|
+
const provider = ref(null);
|
|
1077
|
+
const authResponse = ref(null);
|
|
1078
|
+
const { sso: sso2, user, accountInfo: accountInfo2 } = useAuth();
|
|
1079
|
+
const route = useRoute();
|
|
1080
|
+
const router = useRouter();
|
|
1081
|
+
const providerInfo = computed(() => {
|
|
1082
|
+
if (provider.value === null) return null;
|
|
1083
|
+
return providers[provider.value];
|
|
1084
|
+
});
|
|
1085
|
+
async function linkCallback() {
|
|
1086
|
+
isLinking.value = true;
|
|
1087
|
+
try {
|
|
1088
|
+
await sso2.handleLinkCallback();
|
|
1089
|
+
success.value = true;
|
|
1090
|
+
setTimeout(() => router.push("/"), timeout);
|
|
1091
|
+
} catch (err) {
|
|
1092
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to link account";
|
|
1093
|
+
error.value = errorMessage;
|
|
1094
|
+
} finally {
|
|
1095
|
+
isLoading.value = false;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
async function handleCallback() {
|
|
1099
|
+
var _a;
|
|
1100
|
+
const { state } = route.query;
|
|
1101
|
+
provider.value = sessionStorage.getItem(`oauth_provider:${state}`);
|
|
1102
|
+
try {
|
|
1103
|
+
const response = await sso2.handleCallback();
|
|
1104
|
+
if (response === null) {
|
|
1105
|
+
error.value = `Failed to authenticate with ${((_a = providerInfo.value) == null ? void 0 : _a.name) ?? "provider"}`;
|
|
1106
|
+
} else {
|
|
1107
|
+
authResponse.value = response;
|
|
1108
|
+
success.value = true;
|
|
1109
|
+
setTimeout(() => router.push("/"), timeout);
|
|
1110
|
+
}
|
|
1111
|
+
} catch (err) {
|
|
1112
|
+
const errorMessage = err instanceof Error ? err.message : "Authentication failed";
|
|
1113
|
+
error.value = errorMessage;
|
|
1114
|
+
} finally {
|
|
1115
|
+
isLoading.value = false;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
onMounted(async () => {
|
|
1119
|
+
if (user.value) {
|
|
1120
|
+
await linkCallback();
|
|
1121
|
+
} else {
|
|
1122
|
+
await handleCallback();
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
return (_ctx, _cache) => {
|
|
1126
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
1127
|
+
createVNode(unref(Card), { class: "p-2 txt-center w450px shadow" }, {
|
|
1128
|
+
default: withCtx(() => {
|
|
1129
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1130
|
+
return [
|
|
1131
|
+
isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
1132
|
+
createVNode(unref(Loading)),
|
|
1133
|
+
createElementVNode("div", _hoisted_3, [
|
|
1134
|
+
createElementVNode("h2", _hoisted_4, toDisplayString(isLinking.value ? "Linking Account" : "Authenticating"), 1),
|
|
1135
|
+
createElementVNode("p", _hoisted_5, " Please wait while we " + toDisplayString(isLinking.value ? "link your" : "complete the") + " " + toDisplayString(((_a = providerInfo.value) == null ? void 0 : _a.name) || "OAuth") + " " + toDisplayString(isLinking.value ? "account" : "authentication") + ". ", 1)
|
|
1136
|
+
])
|
|
1137
|
+
])) : success.value && !error.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
1138
|
+
createElementVNode("div", _hoisted_7, [
|
|
1139
|
+
createElementVNode("div", _hoisted_8, [
|
|
1140
|
+
createVNode(unref(Icon), {
|
|
1141
|
+
name: "check_circle",
|
|
1142
|
+
size: "5",
|
|
1143
|
+
class: "txt-green line-height-1"
|
|
1144
|
+
}),
|
|
1145
|
+
providerInfo.value ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
1146
|
+
createVNode(unref(Icon), {
|
|
1147
|
+
name: providerInfo.value.icon,
|
|
1148
|
+
size: "1.5",
|
|
1149
|
+
style: normalizeStyle({ color: providerInfo.value.color })
|
|
1150
|
+
}, null, 8, ["name", "style"])
|
|
1151
|
+
])) : createCommentVNode("", true)
|
|
1152
|
+
])
|
|
1153
|
+
]),
|
|
1154
|
+
createElementVNode("div", null, [
|
|
1155
|
+
createElementVNode("h2", _hoisted_10, toDisplayString(isLinking.value ? "Account Linked!" : "Welcome Back!"), 1),
|
|
1156
|
+
createElementVNode("p", _hoisted_11, toDisplayString(isLinking.value ? `Successfully linked your ${((_b = providerInfo.value) == null ? void 0 : _b.name) || "account"}.` : `You've successfully signed in with ${((_c = providerInfo.value) == null ? void 0 : _c.name) || "your account"}.`), 1),
|
|
1157
|
+
unref(user) || unref(accountInfo2) ? (openBlock(), createElementBlock("div", _hoisted_12, [
|
|
1158
|
+
createElementVNode("div", _hoisted_13, [
|
|
1159
|
+
((_d = unref(user)) == null ? void 0 : _d.name) ? (openBlock(), createElementBlock("div", _hoisted_14, [
|
|
1160
|
+
createVNode(unref(Icon), {
|
|
1161
|
+
name: "person",
|
|
1162
|
+
size: "1.2",
|
|
1163
|
+
class: "opacity-7"
|
|
1164
|
+
}),
|
|
1165
|
+
createElementVNode("span", _hoisted_15, toDisplayString(unref(user).name), 1)
|
|
1166
|
+
])) : createCommentVNode("", true),
|
|
1167
|
+
((_e = unref(user)) == null ? void 0 : _e.email) ? (openBlock(), createElementBlock("div", _hoisted_16, [
|
|
1168
|
+
createVNode(unref(Icon), {
|
|
1169
|
+
name: "email",
|
|
1170
|
+
size: "1.2",
|
|
1171
|
+
class: "opacity-7"
|
|
1172
|
+
}),
|
|
1173
|
+
createElementVNode("span", _hoisted_17, toDisplayString(unref(user).email), 1)
|
|
1174
|
+
])) : createCommentVNode("", true),
|
|
1175
|
+
((_f = unref(accountInfo2)) == null ? void 0 : _f.authentication_methods) ? (openBlock(), createElementBlock("div", _hoisted_18, [
|
|
1176
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(accountInfo2).authentication_methods, (method) => {
|
|
1177
|
+
return openBlock(), createBlock(unref(Icon), {
|
|
1178
|
+
key: method.id,
|
|
1179
|
+
name: method.type === "sso" ? method.provider || "link" : "password",
|
|
1180
|
+
size: "1.2",
|
|
1181
|
+
class: "opacity-5"
|
|
1182
|
+
}, null, 8, ["name"]);
|
|
1183
|
+
}), 128))
|
|
1184
|
+
])) : createCommentVNode("", true)
|
|
1185
|
+
])
|
|
1186
|
+
])) : createCommentVNode("", true),
|
|
1187
|
+
_cache[0] || (_cache[0] = createElementVNode("p", { class: "txt-12 opacity-5 mt-1" }, " Redirecting you to home... ", -1))
|
|
1188
|
+
])
|
|
1189
|
+
])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_19, [
|
|
1190
|
+
createVNode(unref(Icon), {
|
|
1191
|
+
name: "error",
|
|
1192
|
+
size: "5",
|
|
1193
|
+
class: "txt-red mb-1 line-height-1"
|
|
1194
|
+
}),
|
|
1195
|
+
createElementVNode("div", null, [
|
|
1196
|
+
_cache[1] || (_cache[1] = createElementVNode("h2", { class: "mb-05 pb-0 mt-0 txt24 m_txt20" }, " Authentication Failed ", -1)),
|
|
1197
|
+
createElementVNode("p", _hoisted_20, toDisplayString(error.value), 1),
|
|
1198
|
+
_cache[2] || (_cache[2] = createElementVNode("div", { class: "bg-red-light rounded p-1 mt-1 mb-1" }, [
|
|
1199
|
+
createElementVNode("p", { class: "txt-12 opacity-7" }, " This could happen if: "),
|
|
1200
|
+
createElementVNode("ul", {
|
|
1201
|
+
class: "txt-12 opacity-7 txt-start mt-05",
|
|
1202
|
+
style: { "list-style": "none", "padding-left": "0" }
|
|
1203
|
+
}, [
|
|
1204
|
+
createElementVNode("li", { class: "mb-025" }, " • The authorization was cancelled "),
|
|
1205
|
+
createElementVNode("li", { class: "mb-025" }, " • The state parameter was invalid "),
|
|
1206
|
+
createElementVNode("li", { class: "mb-025" }, " • The OAuth provider denied access "),
|
|
1207
|
+
createElementVNode("li", { class: "mb-025" }, " • Network connectivity issues ")
|
|
1208
|
+
])
|
|
1209
|
+
], -1)),
|
|
1210
|
+
createElementVNode("div", _hoisted_21, [
|
|
1211
|
+
createVNode(unref(Btn), {
|
|
1212
|
+
outline: "",
|
|
1213
|
+
value: "Try Again",
|
|
1214
|
+
to: "/login"
|
|
1215
|
+
}),
|
|
1216
|
+
createVNode(unref(Btn), {
|
|
1217
|
+
value: "Go Home",
|
|
1218
|
+
to: "/"
|
|
1219
|
+
})
|
|
1220
|
+
])
|
|
1221
|
+
])
|
|
1222
|
+
])) : createCommentVNode("", true)
|
|
1223
|
+
];
|
|
1224
|
+
}),
|
|
1225
|
+
_: 1
|
|
1226
|
+
})
|
|
1227
|
+
]);
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
const _hoisted_1$3 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1232
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1233
|
+
__name: "ForgotPasswordPage",
|
|
1234
|
+
props: {
|
|
1235
|
+
texts: {},
|
|
1236
|
+
cardWidth: { default: "450px" },
|
|
1237
|
+
cardShadow: { type: Boolean, default: true }
|
|
1238
|
+
},
|
|
1239
|
+
setup(__props) {
|
|
1240
|
+
const router = useRouter();
|
|
1241
|
+
function switchForm(form) {
|
|
1242
|
+
if (form === "login") {
|
|
1243
|
+
router.push("/login");
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return (_ctx, _cache) => {
|
|
1247
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
1248
|
+
createVNode(unref(Card), {
|
|
1249
|
+
class: normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1250
|
+
style: normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1251
|
+
}, {
|
|
1252
|
+
default: withCtx(() => [
|
|
1253
|
+
createVNode(_sfc_main$8, {
|
|
1254
|
+
texts: _ctx.texts,
|
|
1255
|
+
onSwitchForm: switchForm
|
|
1256
|
+
}, null, 8, ["texts"])
|
|
1257
|
+
]),
|
|
1258
|
+
_: 1
|
|
1259
|
+
}, 8, ["class", "style"])
|
|
1260
|
+
]);
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
const _hoisted_1$2 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1265
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1266
|
+
__name: "LoginPage",
|
|
1267
|
+
props: {
|
|
1268
|
+
texts: {},
|
|
1269
|
+
showGithub: { type: Boolean, default: true },
|
|
1270
|
+
showGoogle: { type: Boolean, default: true },
|
|
1271
|
+
showMicrosoft: { type: Boolean, default: true },
|
|
1272
|
+
showApple: { type: Boolean, default: true },
|
|
1273
|
+
showOkta: { type: Boolean, default: true },
|
|
1274
|
+
showFacebook: { type: Boolean, default: true },
|
|
1275
|
+
ssoOutline: { type: Boolean, default: true },
|
|
1276
|
+
ssoShowValue: { type: Boolean, default: true },
|
|
1277
|
+
ssoBrandBackground: { type: Boolean, default: true },
|
|
1278
|
+
showForgotPassword: { type: Boolean, default: true },
|
|
1279
|
+
showSignupButton: { type: Boolean, default: true },
|
|
1280
|
+
cardWidth: { default: "450px" },
|
|
1281
|
+
cardShadow: { type: Boolean, default: true }
|
|
1282
|
+
},
|
|
1283
|
+
setup(__props) {
|
|
1284
|
+
const router = useRouter();
|
|
1285
|
+
function switchForm(form) {
|
|
1286
|
+
if (form === "signup") {
|
|
1287
|
+
router.push("/signup");
|
|
1288
|
+
} else if (form === "forgot-password") {
|
|
1289
|
+
router.push("/forgot-password");
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
return (_ctx, _cache) => {
|
|
1293
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
1294
|
+
createVNode(unref(Card), {
|
|
1295
|
+
class: normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1296
|
+
style: normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1297
|
+
}, {
|
|
1298
|
+
default: withCtx(() => [
|
|
1299
|
+
createVNode(_sfc_main$7, {
|
|
1300
|
+
texts: _ctx.texts,
|
|
1301
|
+
github: _ctx.showGithub,
|
|
1302
|
+
google: _ctx.showGoogle,
|
|
1303
|
+
microsoft: _ctx.showMicrosoft,
|
|
1304
|
+
apple: _ctx.showApple,
|
|
1305
|
+
okta: _ctx.showOkta,
|
|
1306
|
+
facebook: _ctx.showFacebook,
|
|
1307
|
+
"sso-outline": _ctx.ssoOutline,
|
|
1308
|
+
"sso-show-value": _ctx.ssoShowValue,
|
|
1309
|
+
"sso-brand-background": _ctx.ssoBrandBackground,
|
|
1310
|
+
"show-forgot-password": _ctx.showForgotPassword,
|
|
1311
|
+
"show-signup-button": _ctx.showSignupButton,
|
|
1312
|
+
onSwitchForm: switchForm
|
|
1313
|
+
}, null, 8, ["texts", "github", "google", "microsoft", "apple", "okta", "facebook", "sso-outline", "sso-show-value", "sso-brand-background", "show-forgot-password", "show-signup-button"])
|
|
1314
|
+
]),
|
|
1315
|
+
_: 1
|
|
1316
|
+
}, 8, ["class", "style"])
|
|
1317
|
+
]);
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
const _hoisted_1$1 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1322
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1323
|
+
__name: "ResetPasswordPage",
|
|
1324
|
+
props: {
|
|
1325
|
+
texts: {},
|
|
1326
|
+
cardWidth: { default: "450px" },
|
|
1327
|
+
cardShadow: { type: Boolean, default: true }
|
|
1328
|
+
},
|
|
1329
|
+
setup(__props) {
|
|
1330
|
+
const router = useRouter();
|
|
1331
|
+
const route = useRoute();
|
|
1332
|
+
const token = computed(() => route.query.token);
|
|
1333
|
+
function switchForm(form) {
|
|
1334
|
+
if (form === "login") {
|
|
1335
|
+
router.push("/login");
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return (_ctx, _cache) => {
|
|
1339
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1340
|
+
createVNode(unref(Card), {
|
|
1341
|
+
class: normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1342
|
+
style: normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1343
|
+
}, {
|
|
1344
|
+
default: withCtx(() => [
|
|
1345
|
+
createVNode(_sfc_main$6, {
|
|
1346
|
+
texts: _ctx.texts,
|
|
1347
|
+
token: token.value,
|
|
1348
|
+
onSwitchForm: switchForm
|
|
1349
|
+
}, null, 8, ["texts", "token"])
|
|
1350
|
+
]),
|
|
1351
|
+
_: 1
|
|
1352
|
+
}, 8, ["class", "style"])
|
|
1353
|
+
]);
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
const _hoisted_1 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1358
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1359
|
+
__name: "SignupPage",
|
|
1360
|
+
props: {
|
|
1361
|
+
texts: {},
|
|
1362
|
+
showNames: { type: Boolean, default: true },
|
|
1363
|
+
cardWidth: { default: "450px" },
|
|
1364
|
+
cardShadow: { type: Boolean, default: true }
|
|
1365
|
+
},
|
|
1366
|
+
setup(__props) {
|
|
1367
|
+
const router = useRouter();
|
|
1368
|
+
function switchForm(form) {
|
|
1369
|
+
if (form === "login") {
|
|
1370
|
+
router.push("/login");
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return (_ctx, _cache) => {
|
|
1374
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1375
|
+
createVNode(unref(Card), {
|
|
1376
|
+
class: normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1377
|
+
style: normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1378
|
+
}, {
|
|
1379
|
+
default: withCtx(() => [
|
|
1380
|
+
createVNode(_sfc_main$5, {
|
|
1381
|
+
texts: _ctx.texts,
|
|
1382
|
+
"show-names": _ctx.showNames,
|
|
1383
|
+
onSwitchForm: switchForm
|
|
1384
|
+
}, null, 8, ["texts", "show-names"])
|
|
1385
|
+
]),
|
|
1386
|
+
_: 1
|
|
1387
|
+
}, 8, ["class", "style"])
|
|
1388
|
+
]);
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
});
|
|
1392
|
+
function createAuthRoutes(config = {}) {
|
|
1393
|
+
const {
|
|
1394
|
+
basePath = "",
|
|
1395
|
+
namePrefix = "",
|
|
1396
|
+
routeNames = {},
|
|
1397
|
+
layout
|
|
1398
|
+
} = config;
|
|
1399
|
+
const createRouteName = (name) => namePrefix ? `${namePrefix}${name}` : name;
|
|
1400
|
+
const routes = [
|
|
1401
|
+
{
|
|
1402
|
+
path: `${basePath}/login`,
|
|
1403
|
+
name: routeNames.login || createRouteName("Login"),
|
|
1404
|
+
component: () => import("./LoginPage-klj1NV4J.js"),
|
|
1405
|
+
meta: { requiresAuth: false }
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
path: `${basePath}/signup`,
|
|
1409
|
+
name: routeNames.signup || createRouteName("Signup"),
|
|
1410
|
+
component: () => import("./SignupPage-oUFYApYW.js"),
|
|
1411
|
+
meta: { requiresAuth: false }
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
path: `${basePath}/forgot-password`,
|
|
1415
|
+
name: routeNames.forgotPassword || createRouteName("ForgotPassword"),
|
|
1416
|
+
component: () => import("./ForgotPasswordPage-DvttMGb0.js"),
|
|
1417
|
+
meta: { requiresAuth: false }
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
path: `${basePath}/reset-password`,
|
|
1421
|
+
name: routeNames.resetPassword || createRouteName("ResetPassword"),
|
|
1422
|
+
component: () => import("./ResetPasswordPage-nvQ4uupb.js"),
|
|
1423
|
+
meta: { requiresAuth: false }
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
path: `${basePath}/callback`,
|
|
1427
|
+
name: routeNames.callback || createRouteName("AuthCallback"),
|
|
1428
|
+
component: () => import("./Callback-C-XghN_z.js"),
|
|
1429
|
+
meta: { requiresAuth: false }
|
|
1430
|
+
}
|
|
1431
|
+
];
|
|
1432
|
+
if (layout) {
|
|
1433
|
+
return [{
|
|
1434
|
+
path: basePath,
|
|
1435
|
+
component: layout,
|
|
1436
|
+
children: routes.map((route) => ({
|
|
1437
|
+
...route,
|
|
1438
|
+
path: route.path.replace(basePath, "")
|
|
1439
|
+
}))
|
|
1440
|
+
}];
|
|
1441
|
+
}
|
|
1442
|
+
return routes;
|
|
1443
|
+
}
|
|
1444
|
+
function createAuthGuard(config = {}) {
|
|
1445
|
+
const { redirectTo = "/" } = config;
|
|
1446
|
+
return async (to, _from, next) => {
|
|
1447
|
+
const { useAuth: useAuth2 } = await Promise.resolve().then(() => useAuth$1);
|
|
1448
|
+
const { user } = useAuth2();
|
|
1449
|
+
if (to.meta.requiresAuth === false && user.value) {
|
|
1450
|
+
next(redirectTo);
|
|
1451
|
+
} else {
|
|
1452
|
+
next();
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
279
1456
|
let authApiRef = null;
|
|
280
|
-
function setAuthContext(
|
|
281
|
-
authApiRef =
|
|
1457
|
+
function setAuthContext(authApi2) {
|
|
1458
|
+
authApiRef = authApi2;
|
|
282
1459
|
}
|
|
283
1460
|
function getAuthApi() {
|
|
284
1461
|
if (authApiRef === null || authApiRef === void 0) {
|
|
@@ -436,7 +1613,7 @@ function createSSOProvider(config) {
|
|
|
436
1613
|
const auth = getAuthApi();
|
|
437
1614
|
const redirectUri = options.redirectUri ?? getDefaultRedirectUri();
|
|
438
1615
|
const state = options.state ?? generateState();
|
|
439
|
-
const
|
|
1616
|
+
const timeout2 = options.popupTimeout ?? 9e4;
|
|
440
1617
|
if (typeof sessionStorage !== "undefined") {
|
|
441
1618
|
sessionStorage.setItem(getStateKey(), state);
|
|
442
1619
|
sessionStorage.setItem(`oauth_provider:${state}`, config.id);
|
|
@@ -453,7 +1630,7 @@ function createSSOProvider(config) {
|
|
|
453
1630
|
if (!popupWindow) {
|
|
454
1631
|
throw new PopupBlockedError();
|
|
455
1632
|
}
|
|
456
|
-
const result = await waitForPopupCallback(popupWindow, config.id,
|
|
1633
|
+
const result = await waitForPopupCallback(popupWindow, config.id, timeout2);
|
|
457
1634
|
return auth.loginWithSSO({
|
|
458
1635
|
provider: config.id,
|
|
459
1636
|
code: result.code,
|
|
@@ -666,7 +1843,6 @@ function handleOAuthLinkCallback() {
|
|
|
666
1843
|
}
|
|
667
1844
|
return ssoProviders[provider].link(code, state);
|
|
668
1845
|
}
|
|
669
|
-
|
|
670
1846
|
var AuthState = /* @__PURE__ */ ((AuthState2) => {
|
|
671
1847
|
AuthState2["LOGIN"] = "login";
|
|
672
1848
|
AuthState2["LOGOUT"] = "logout";
|
|
@@ -717,14 +1893,13 @@ function accountToUser(account) {
|
|
|
717
1893
|
id: account.id,
|
|
718
1894
|
accountId: account.id,
|
|
719
1895
|
name: account.display_name,
|
|
720
|
-
email: emailMethod
|
|
1896
|
+
email: emailMethod == null ? void 0 : emailMethod.identifier,
|
|
721
1897
|
type: account.account_type,
|
|
722
1898
|
isActive: account.is_active,
|
|
723
1899
|
isVerified: account.is_verified,
|
|
724
1900
|
lastLogin: account.last_login
|
|
725
1901
|
};
|
|
726
1902
|
}
|
|
727
|
-
|
|
728
1903
|
let authApi = null;
|
|
729
1904
|
let eventEmitter = null;
|
|
730
1905
|
const accountInfo = ref(null);
|
|
@@ -793,25 +1968,31 @@ function useAuth() {
|
|
|
793
1968
|
setAuthContext(authMethods);
|
|
794
1969
|
const user = computed(() => accountToUser(accountInfo.value));
|
|
795
1970
|
const getFullName = () => {
|
|
796
|
-
|
|
1971
|
+
var _a;
|
|
1972
|
+
return ((_a = user.value) == null ? void 0 : _a.name) ?? "";
|
|
797
1973
|
};
|
|
798
1974
|
const getIsLoggedIn = () => {
|
|
799
1975
|
return user.value !== null;
|
|
800
1976
|
};
|
|
801
1977
|
const getEmail = () => {
|
|
802
|
-
|
|
1978
|
+
var _a;
|
|
1979
|
+
return ((_a = user.value) == null ? void 0 : _a.email) ?? "";
|
|
803
1980
|
};
|
|
804
1981
|
const getRoles = () => {
|
|
805
|
-
|
|
1982
|
+
var _a;
|
|
1983
|
+
return ((_a = user.value) == null ? void 0 : _a.roles) ?? [];
|
|
806
1984
|
};
|
|
807
1985
|
const getAccountType = () => {
|
|
808
|
-
|
|
1986
|
+
var _a;
|
|
1987
|
+
return ((_a = user.value) == null ? void 0 : _a.type) ?? "person";
|
|
809
1988
|
};
|
|
810
1989
|
const isPersonAccount = () => {
|
|
811
|
-
|
|
1990
|
+
var _a;
|
|
1991
|
+
return ((_a = user.value) == null ? void 0 : _a.type) === "person";
|
|
812
1992
|
};
|
|
813
1993
|
const isEntityAccount = () => {
|
|
814
|
-
|
|
1994
|
+
var _a;
|
|
1995
|
+
return ((_a = user.value) == null ? void 0 : _a.type) === "entity";
|
|
815
1996
|
};
|
|
816
1997
|
async function logout() {
|
|
817
1998
|
const logoutPromise = api.logout();
|
|
@@ -913,7 +2094,8 @@ function useAuth() {
|
|
|
913
2094
|
emitter.emit(AuthState.SESSION_REFRESH);
|
|
914
2095
|
}
|
|
915
2096
|
async function getSessions(accountId) {
|
|
916
|
-
|
|
2097
|
+
var _a;
|
|
2098
|
+
const id = accountId ?? ((_a = user.value) == null ? void 0 : _a.accountId);
|
|
917
2099
|
if (id === void 0 || id === "") {
|
|
918
2100
|
throw new Error("No account ID available");
|
|
919
2101
|
}
|
|
@@ -923,7 +2105,8 @@ function useAuth() {
|
|
|
923
2105
|
await api.revokeSession(sessionToken);
|
|
924
2106
|
}
|
|
925
2107
|
async function revokeAllSessions(accountId) {
|
|
926
|
-
|
|
2108
|
+
var _a;
|
|
2109
|
+
const id = accountId ?? ((_a = user.value) == null ? void 0 : _a.accountId);
|
|
927
2110
|
if (id === void 0 || id === "") {
|
|
928
2111
|
throw new Error("No account ID available");
|
|
929
2112
|
}
|
|
@@ -996,5 +2179,40 @@ function useAuth() {
|
|
|
996
2179
|
revokeAllSessions
|
|
997
2180
|
};
|
|
998
2181
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
2182
|
+
const useAuth$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2183
|
+
__proto__: null,
|
|
2184
|
+
initAuth,
|
|
2185
|
+
useAuth
|
|
2186
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2187
|
+
export {
|
|
2188
|
+
AuthApi,
|
|
2189
|
+
AuthState,
|
|
2190
|
+
_sfc_main$4 as Callback,
|
|
2191
|
+
DEFAULT_AGENT_ID,
|
|
2192
|
+
_sfc_main$8 as ForgotPasswordForm,
|
|
2193
|
+
_sfc_main$3 as ForgotPasswordPage,
|
|
2194
|
+
INTAKE_WORKFLOW_ID,
|
|
2195
|
+
_sfc_main$7 as LoginForm,
|
|
2196
|
+
_sfc_main$2 as LoginPage,
|
|
2197
|
+
PopupBlockedError,
|
|
2198
|
+
PopupClosedError,
|
|
2199
|
+
PopupTimeoutError,
|
|
2200
|
+
_sfc_main$6 as ResetPasswordForm,
|
|
2201
|
+
_sfc_main$1 as ResetPasswordPage,
|
|
2202
|
+
SSOError,
|
|
2203
|
+
_sfc_main$5 as SignupForm,
|
|
2204
|
+
_sfc_main as SignupPage,
|
|
2205
|
+
StateMismatchError,
|
|
2206
|
+
accountToUser,
|
|
2207
|
+
createAuthGuard,
|
|
2208
|
+
createAuthRoutes,
|
|
2209
|
+
getAllSSOProviders,
|
|
2210
|
+
getSSOProvider,
|
|
2211
|
+
initAuth,
|
|
2212
|
+
isSupportedProvider,
|
|
2213
|
+
providers,
|
|
2214
|
+
setAuthContext,
|
|
2215
|
+
sso,
|
|
2216
|
+
ssoProvidersList,
|
|
2217
|
+
useAuth
|
|
2218
|
+
};
|