@bagelink/auth 1.12.3 → 1.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +54 -1
- package/dist/index.cjs +154 -1181
- package/dist/index.d.ts +0 -9
- package/dist/index.mjs +155 -1182
- package/dist/routes.d.ts +0 -36
- package/dist/types.d.ts +68 -1
- package/dist/useAuth.d.ts +17 -1
- package/package.json +1 -1
- package/src/api.ts +118 -0
- package/src/index.ts +0 -13
- package/src/routes.ts +0 -96
- package/src/types.ts +81 -1
- package/src/useAuth.ts +103 -0
- package/dist/Callback-BHqVaZZm.cjs +0 -4
- package/dist/Callback-C-XghN_z.js +0 -4
- package/dist/ForgotPasswordPage-BV9tyhHl.cjs +0 -4
- package/dist/ForgotPasswordPage-DvttMGb0.js +0 -4
- package/dist/LoginPage-hv1wc54S.cjs +0 -4
- package/dist/LoginPage-klj1NV4J.js +0 -4
- package/dist/ResetPasswordPage-COPrJmW8.cjs +0 -4
- package/dist/ResetPasswordPage-nvQ4uupb.js +0 -4
- package/dist/SignupPage-m36w9PLJ.cjs +0 -4
- package/dist/SignupPage-oUFYApYW.js +0 -4
- package/dist/components/auth/ForgotPasswordForm.vue.d.ts +0 -23
- package/dist/components/auth/LoginForm.vue.d.ts +0 -58
- package/dist/components/auth/ResetPasswordForm.vue.d.ts +0 -28
- package/dist/components/auth/SignupForm.vue.d.ts +0 -34
- package/dist/components/index.d.ts +0 -4
- package/dist/pages/Callback.vue.d.ts +0 -2
- package/dist/pages/ForgotPasswordPage.vue.d.ts +0 -13
- package/dist/pages/LoginPage.vue.d.ts +0 -38
- package/dist/pages/ResetPasswordPage.vue.d.ts +0 -13
- package/dist/pages/SignupPage.vue.d.ts +0 -16
- package/src/components/auth/ForgotPasswordForm.vue +0 -97
- package/src/components/auth/LoginForm.vue +0 -258
- package/src/components/auth/ResetPasswordForm.vue +0 -156
- package/src/components/auth/SignupForm.vue +0 -231
- package/src/components/index.ts +0 -5
- package/src/pages/Callback.vue +0 -196
- package/src/pages/ForgotPasswordPage.vue +0 -42
- package/src/pages/LoginPage.vue +0 -68
- package/src/pages/ResetPasswordPage.vue +0 -47
- package/src/pages/SignupPage.vue +0 -46
package/dist/index.cjs
CHANGED
|
@@ -5,8 +5,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
6
|
const axios = require("axios");
|
|
7
7
|
const vue = require("vue");
|
|
8
|
-
const vue$1 = require("@bagelink/vue");
|
|
9
|
-
const vueRouter = require("vue-router");
|
|
10
8
|
function createAxiosInstance(baseURL) {
|
|
11
9
|
return axios.create({
|
|
12
10
|
baseURL,
|
|
@@ -301,743 +299,92 @@ class AuthApi {
|
|
|
301
299
|
async getTenants() {
|
|
302
300
|
return this.api.get("tenants");
|
|
303
301
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
__name: "ForgotPasswordForm",
|
|
310
|
-
props: {
|
|
311
|
-
emailSent: { type: Boolean, default: false },
|
|
312
|
-
useHebrewDefaults: { type: Boolean, default: false },
|
|
313
|
-
texts: { default: () => ({}) }
|
|
314
|
-
},
|
|
315
|
-
emits: ["switchForm"],
|
|
316
|
-
setup(__props) {
|
|
317
|
-
const props = __props;
|
|
318
|
-
const { forgotPassword } = useAuth();
|
|
319
|
-
const email = vue.ref("");
|
|
320
|
-
const internalEmailSent = vue.ref(false);
|
|
321
|
-
const showEmailSent = vue.computed(() => props.emailSent || internalEmailSent.value);
|
|
322
|
-
const texts = vue.computed(() => {
|
|
323
|
-
var _a, _b, _c, _d, _e, _f;
|
|
324
|
-
const hebrewDefaults = {
|
|
325
|
-
title: "שכחתם סיסמה",
|
|
326
|
-
emailLabel: "איימיל",
|
|
327
|
-
submitButton: "שליחת איימיל איפוס",
|
|
328
|
-
backToLogin: "חזרה להתחברות",
|
|
329
|
-
emailSentTitle: "איימיל נשלח!",
|
|
330
|
-
emailSentMessage: "יש לבדוק את תיבת הדואר שלכם לקישור איפוס הסיסמה"
|
|
331
|
-
};
|
|
332
|
-
const englishDefaults = {
|
|
333
|
-
title: "Forgot Password",
|
|
334
|
-
emailLabel: "Email",
|
|
335
|
-
submitButton: "Send Reset Email",
|
|
336
|
-
backToLogin: "Back to Login",
|
|
337
|
-
emailSentTitle: "Email Sent!",
|
|
338
|
-
emailSentMessage: "Check your inbox for a password reset link"
|
|
339
|
-
};
|
|
340
|
-
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
341
|
-
return {
|
|
342
|
-
title: ((_a = props.texts) == null ? void 0 : _a.title) ?? defaults.title,
|
|
343
|
-
emailLabel: ((_b = props.texts) == null ? void 0 : _b.emailLabel) ?? defaults.emailLabel,
|
|
344
|
-
submitButton: ((_c = props.texts) == null ? void 0 : _c.submitButton) ?? defaults.submitButton,
|
|
345
|
-
backToLogin: ((_d = props.texts) == null ? void 0 : _d.backToLogin) ?? defaults.backToLogin,
|
|
346
|
-
emailSentTitle: ((_e = props.texts) == null ? void 0 : _e.emailSentTitle) ?? defaults.emailSentTitle,
|
|
347
|
-
emailSentMessage: ((_f = props.texts) == null ? void 0 : _f.emailSentMessage) ?? defaults.emailSentMessage
|
|
348
|
-
};
|
|
349
|
-
});
|
|
350
|
-
const textDirection = vue.computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
351
|
-
async function handleRecoverPassword() {
|
|
352
|
-
await forgotPassword(email.value);
|
|
353
|
-
internalEmailSent.value = true;
|
|
354
|
-
}
|
|
355
|
-
return (_ctx, _cache) => {
|
|
356
|
-
return showEmailSent.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
357
|
-
key: 0,
|
|
358
|
-
class: vue.normalizeClass(["txt-center", [textDirection.value]])
|
|
359
|
-
}, [
|
|
360
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
361
|
-
name: "email",
|
|
362
|
-
size: "4",
|
|
363
|
-
class: "opacity-3 mb-1"
|
|
364
|
-
}),
|
|
365
|
-
vue.createElementVNode("h1", _hoisted_1$8, vue.toDisplayString(texts.value.emailSentTitle), 1),
|
|
366
|
-
vue.createElementVNode("p", _hoisted_2$4, vue.toDisplayString(texts.value.emailSentMessage), 1),
|
|
367
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
368
|
-
thin: "",
|
|
369
|
-
flat: "",
|
|
370
|
-
class: "txt-12 mt-2 underline",
|
|
371
|
-
value: texts.value.backToLogin,
|
|
372
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
373
|
-
}, null, 8, ["value"])
|
|
374
|
-
], 2)) : (vue.openBlock(), vue.createElementBlock("form", {
|
|
375
|
-
key: 1,
|
|
376
|
-
class: vue.normalizeClass(textDirection.value),
|
|
377
|
-
onSubmit: vue.withModifiers(handleRecoverPassword, ["prevent"])
|
|
378
|
-
}, [
|
|
379
|
-
vue.createElementVNode("h1", _hoisted_3$4, vue.toDisplayString(texts.value.title), 1),
|
|
380
|
-
vue.createVNode(vue.unref(vue$1.TextInput), {
|
|
381
|
-
modelValue: email.value,
|
|
382
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => email.value = $event),
|
|
383
|
-
label: texts.value.emailLabel,
|
|
384
|
-
autocomplete: "email",
|
|
385
|
-
type: "email"
|
|
386
|
-
}, null, 8, ["modelValue", "label"]),
|
|
387
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
388
|
-
type: "submit",
|
|
389
|
-
class: "w-100 mt-05",
|
|
390
|
-
value: texts.value.submitButton
|
|
391
|
-
}, null, 8, ["value"]),
|
|
392
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
393
|
-
thin: "",
|
|
394
|
-
flat: "",
|
|
395
|
-
class: "txt-12 mt-075 underline block",
|
|
396
|
-
value: texts.value.backToLogin,
|
|
397
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
398
|
-
}, null, 8, ["value"])
|
|
399
|
-
], 34));
|
|
400
|
-
};
|
|
302
|
+
/**
|
|
303
|
+
* Get a single tenant by ID or slug
|
|
304
|
+
*/
|
|
305
|
+
async getTenant(idOrSlug) {
|
|
306
|
+
return this.api.get(`tenants/${idOrSlug}`);
|
|
401
307
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
class: "flex gap-1 opacity-6"
|
|
408
|
-
};
|
|
409
|
-
const _hoisted_4$2 = { class: "txt-center my-05" };
|
|
410
|
-
const _hoisted_5$2 = { class: "h-20px pt-075" };
|
|
411
|
-
const _hoisted_6$2 = {
|
|
412
|
-
key: 0,
|
|
413
|
-
class: "txt-center color-red txt-12"
|
|
414
|
-
};
|
|
415
|
-
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
416
|
-
__name: "LoginForm",
|
|
417
|
-
props: {
|
|
418
|
-
hideRegularLogin: { type: Boolean, default: false },
|
|
419
|
-
showForgotPassword: { type: Boolean, default: true },
|
|
420
|
-
showSignupButton: { type: Boolean, default: true },
|
|
421
|
-
github: { type: Boolean, default: false },
|
|
422
|
-
google: { type: Boolean, default: false },
|
|
423
|
-
microsoft: { type: Boolean, default: false },
|
|
424
|
-
apple: { type: Boolean, default: false },
|
|
425
|
-
okta: { type: Boolean, default: false },
|
|
426
|
-
facebook: { type: Boolean, default: false },
|
|
427
|
-
ssoOutline: { type: Boolean, default: true },
|
|
428
|
-
ssoShowValue: { type: Boolean, default: true },
|
|
429
|
-
ssoSize: { default: void 0 },
|
|
430
|
-
ssoAlign: { type: Boolean, default: false },
|
|
431
|
-
ssoBrandBackground: { type: Boolean, default: true },
|
|
432
|
-
useHebrewDefaults: { type: Boolean, default: false },
|
|
433
|
-
errorState: { default: "normal" },
|
|
434
|
-
texts: { default: () => ({}) }
|
|
435
|
-
},
|
|
436
|
-
emits: ["switchForm"],
|
|
437
|
-
setup(__props) {
|
|
438
|
-
const props = __props;
|
|
439
|
-
const { login, sso: sso2 } = useAuth();
|
|
440
|
-
const form = vue.ref({
|
|
441
|
-
email: "",
|
|
442
|
-
password: ""
|
|
443
|
-
});
|
|
444
|
-
const internalError = vue.ref("");
|
|
445
|
-
const texts = vue.computed(() => {
|
|
446
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
447
|
-
const hebrewDefaults = {
|
|
448
|
-
title: "התחברות",
|
|
449
|
-
emailLabel: "אימייל",
|
|
450
|
-
passwordLabel: "סיסמה",
|
|
451
|
-
forgotPassword: "שכחתם סיסמה?",
|
|
452
|
-
loginButton: "התחברות",
|
|
453
|
-
signupButton: "יצירת חשבון",
|
|
454
|
-
orText: "או",
|
|
455
|
-
githubButton: "התחברות עם GitHub",
|
|
456
|
-
googleButton: "התחברות עם Google",
|
|
457
|
-
microsoftButton: "התחברות עם Microsoft",
|
|
458
|
-
appleButton: "התחברות עם Apple",
|
|
459
|
-
oktaButton: "התחברות עם Okta",
|
|
460
|
-
facebookButton: "התחברות עם Facebook"
|
|
461
|
-
};
|
|
462
|
-
const englishDefaults = {
|
|
463
|
-
title: "Login",
|
|
464
|
-
emailLabel: "Email",
|
|
465
|
-
passwordLabel: "Password",
|
|
466
|
-
forgotPassword: "Forgot Password",
|
|
467
|
-
loginButton: "Login",
|
|
468
|
-
signupButton: "Create Account",
|
|
469
|
-
orText: "or",
|
|
470
|
-
githubButton: "Continue with GitHub",
|
|
471
|
-
googleButton: "Continue with Google",
|
|
472
|
-
microsoftButton: "Continue with Microsoft",
|
|
473
|
-
appleButton: "Continue with Apple",
|
|
474
|
-
oktaButton: "Continue with Okta",
|
|
475
|
-
facebookButton: "Continue with Facebook"
|
|
476
|
-
};
|
|
477
|
-
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
478
|
-
return {
|
|
479
|
-
title: ((_a = props.texts) == null ? void 0 : _a.title) ?? defaults.title,
|
|
480
|
-
emailLabel: ((_b = props.texts) == null ? void 0 : _b.emailLabel) ?? defaults.emailLabel,
|
|
481
|
-
passwordLabel: ((_c = props.texts) == null ? void 0 : _c.passwordLabel) ?? defaults.passwordLabel,
|
|
482
|
-
forgotPassword: ((_d = props.texts) == null ? void 0 : _d.forgotPassword) ?? defaults.forgotPassword,
|
|
483
|
-
loginButton: ((_e = props.texts) == null ? void 0 : _e.loginButton) ?? defaults.loginButton,
|
|
484
|
-
signupButton: ((_f = props.texts) == null ? void 0 : _f.signupButton) ?? defaults.signupButton,
|
|
485
|
-
orText: ((_g = props.texts) == null ? void 0 : _g.orText) ?? defaults.orText,
|
|
486
|
-
githubButton: ((_h = props.texts) == null ? void 0 : _h.githubButton) ?? defaults.githubButton,
|
|
487
|
-
googleButton: ((_i = props.texts) == null ? void 0 : _i.googleButton) ?? defaults.googleButton,
|
|
488
|
-
microsoftButton: ((_j = props.texts) == null ? void 0 : _j.microsoftButton) ?? defaults.microsoftButton,
|
|
489
|
-
appleButton: ((_k = props.texts) == null ? void 0 : _k.appleButton) ?? defaults.appleButton,
|
|
490
|
-
oktaButton: ((_l = props.texts) == null ? void 0 : _l.oktaButton) ?? defaults.oktaButton,
|
|
491
|
-
facebookButton: ((_m = props.texts) == null ? void 0 : _m.facebookButton) ?? defaults.facebookButton
|
|
492
|
-
};
|
|
493
|
-
});
|
|
494
|
-
const showAnySso = vue.computed(
|
|
495
|
-
() => props.github || props.google || props.microsoft || props.apple || props.okta || props.facebook
|
|
496
|
-
);
|
|
497
|
-
const textDirection = vue.computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
498
|
-
const error = vue.computed(() => getDevError() || internalError.value);
|
|
499
|
-
function getDevError() {
|
|
500
|
-
switch (props.errorState) {
|
|
501
|
-
case "email-required":
|
|
502
|
-
return props.useHebrewDefaults ? "איימיל נדרש" : "Email is required";
|
|
503
|
-
case "email-invalid":
|
|
504
|
-
return props.useHebrewDefaults ? "יש להזין כתובת איימיל תקינה" : "Please enter a valid email address";
|
|
505
|
-
case "password-required":
|
|
506
|
-
return props.useHebrewDefaults ? "סיסמה נדרשת" : "Password is required";
|
|
507
|
-
case "invalid-credentials":
|
|
508
|
-
return props.useHebrewDefaults ? "איימיל או סיסמה לא נכונים" : "Invalid email or password";
|
|
509
|
-
case "server-error":
|
|
510
|
-
return props.useHebrewDefaults ? "ההתחברות נכשלה. אנא נסה שוב." : "Login failed. Please try again.";
|
|
511
|
-
default:
|
|
512
|
-
return null;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
async function handleLogin() {
|
|
516
|
-
internalError.value = "";
|
|
517
|
-
if (props.errorState !== "normal") {
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
const { message } = await login(form.value);
|
|
521
|
-
internalError.value = message;
|
|
522
|
-
}
|
|
523
|
-
return (_ctx, _cache) => {
|
|
524
|
-
const _directive_tooltip = vue.resolveDirective("tooltip");
|
|
525
|
-
return vue.openBlock(), vue.createElementBlock("form", {
|
|
526
|
-
class: vue.normalizeClass(textDirection.value),
|
|
527
|
-
onSubmit: vue.withModifiers(handleLogin, ["prevent"])
|
|
528
|
-
}, [
|
|
529
|
-
vue.createElementVNode("h1", _hoisted_1$7, vue.toDisplayString(texts.value.title), 1),
|
|
530
|
-
!props.hideRegularLogin ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
531
|
-
vue.createVNode(vue.unref(vue$1.TextInput), {
|
|
532
|
-
modelValue: form.value.email,
|
|
533
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value.email = $event),
|
|
534
|
-
type: "email",
|
|
535
|
-
label: texts.value.emailLabel,
|
|
536
|
-
autocomplete: "email"
|
|
537
|
-
}, null, 8, ["modelValue", "label"]),
|
|
538
|
-
vue.createVNode(vue.unref(vue$1.PasswordInput), {
|
|
539
|
-
modelValue: form.value.password,
|
|
540
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.password = $event),
|
|
541
|
-
label: texts.value.passwordLabel
|
|
542
|
-
}, null, 8, ["modelValue", "label"]),
|
|
543
|
-
props.showForgotPassword ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
544
|
-
key: 0,
|
|
545
|
-
thin: "",
|
|
546
|
-
flat: "",
|
|
547
|
-
class: "txt-12 mt-075 underline block",
|
|
548
|
-
value: texts.value.forgotPassword,
|
|
549
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("switchForm", "forgot-password"))
|
|
550
|
-
}, null, 8, ["value"])) : vue.createCommentVNode("", true),
|
|
551
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
552
|
-
type: "submit",
|
|
553
|
-
class: "w-100 mt-1",
|
|
554
|
-
value: texts.value.loginButton
|
|
555
|
-
}, null, 8, ["value"]),
|
|
556
|
-
props.showSignupButton ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
557
|
-
key: 1,
|
|
558
|
-
outline: "",
|
|
559
|
-
color: "primary",
|
|
560
|
-
class: "w-100 mt-05",
|
|
561
|
-
value: texts.value.signupButton,
|
|
562
|
-
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("switchForm", "signup"))
|
|
563
|
-
}, null, 8, ["value"])) : vue.createCommentVNode("", true)
|
|
564
|
-
], 64)) : vue.createCommentVNode("", true),
|
|
565
|
-
showAnySso.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
|
|
566
|
-
!props.hideRegularLogin ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
|
|
567
|
-
_cache[10] || (_cache[10] = vue.createElementVNode("div", { class: "line" }, null, -1)),
|
|
568
|
-
vue.createElementVNode("p", _hoisted_4$2, vue.toDisplayString(texts.value.orText), 1),
|
|
569
|
-
_cache[11] || (_cache[11] = vue.createElementVNode("div", { class: "line" }, null, -1))
|
|
570
|
-
])) : vue.createCommentVNode("", true),
|
|
571
|
-
vue.createElementVNode("div", {
|
|
572
|
-
class: vue.normalizeClass(["gap-05", { "grid grid-wrap-1": props.ssoShowValue, "flex justify-content-center gap-05 flex-wrap": !props.ssoShowValue }])
|
|
573
|
-
}, [
|
|
574
|
-
props.github ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
575
|
-
key: 0,
|
|
576
|
-
outline: props.ssoOutline,
|
|
577
|
-
"full-width": props.ssoAlign,
|
|
578
|
-
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
579
|
-
style: vue.normalizeStyle(props.ssoOutline ? "color: #24292F;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #24292F;" : ""}`),
|
|
580
|
-
icon: "github",
|
|
581
|
-
class: vue.normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
582
|
-
value: props.ssoShowValue ? texts.value.githubButton : void 0,
|
|
583
|
-
size: props.ssoSize,
|
|
584
|
-
onClick: _cache[4] || (_cache[4] = ($event) => vue.unref(sso2).github.redirect())
|
|
585
|
-
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
586
|
-
[_directive_tooltip, !props.ssoShowValue ? texts.value.githubButton : void 0]
|
|
587
|
-
]) : vue.createCommentVNode("", true),
|
|
588
|
-
props.google ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
589
|
-
key: 1,
|
|
590
|
-
outline: props.ssoOutline,
|
|
591
|
-
"full-width": props.ssoAlign,
|
|
592
|
-
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
593
|
-
style: vue.normalizeStyle(props.ssoOutline ? "color: #DB4437;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #DB4437;" : ""}`),
|
|
594
|
-
icon: "google",
|
|
595
|
-
class: vue.normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
596
|
-
value: props.ssoShowValue ? texts.value.googleButton : void 0,
|
|
597
|
-
size: props.ssoSize,
|
|
598
|
-
onClick: _cache[5] || (_cache[5] = ($event) => vue.unref(sso2).google.redirect())
|
|
599
|
-
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
600
|
-
[_directive_tooltip, !props.ssoShowValue ? texts.value.googleButton : void 0]
|
|
601
|
-
]) : vue.createCommentVNode("", true),
|
|
602
|
-
props.microsoft ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
603
|
-
key: 2,
|
|
604
|
-
outline: props.ssoOutline,
|
|
605
|
-
"full-width": props.ssoAlign,
|
|
606
|
-
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
607
|
-
style: vue.normalizeStyle(props.ssoOutline ? "color: #2F2FEE;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #2F2FEE;" : ""}`),
|
|
608
|
-
icon: "microsoft",
|
|
609
|
-
class: vue.normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
610
|
-
value: props.ssoShowValue ? texts.value.microsoftButton : void 0,
|
|
611
|
-
size: props.ssoSize,
|
|
612
|
-
onClick: _cache[6] || (_cache[6] = ($event) => vue.unref(sso2).microsoft.redirect())
|
|
613
|
-
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
614
|
-
[_directive_tooltip, !props.ssoShowValue ? texts.value.microsoftButton : void 0]
|
|
615
|
-
]) : vue.createCommentVNode("", true),
|
|
616
|
-
props.apple ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
617
|
-
key: 3,
|
|
618
|
-
outline: props.ssoOutline,
|
|
619
|
-
"full-width": props.ssoAlign,
|
|
620
|
-
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
621
|
-
style: vue.normalizeStyle(props.ssoOutline ? "color: #000000;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #000000;" : ""}`),
|
|
622
|
-
icon: "apple",
|
|
623
|
-
class: vue.normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
624
|
-
value: props.ssoShowValue ? texts.value.appleButton : void 0,
|
|
625
|
-
size: props.ssoSize,
|
|
626
|
-
onClick: _cache[7] || (_cache[7] = ($event) => vue.unref(sso2).apple.redirect())
|
|
627
|
-
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
628
|
-
[_directive_tooltip, !props.ssoShowValue ? texts.value.appleButton : void 0]
|
|
629
|
-
]) : vue.createCommentVNode("", true),
|
|
630
|
-
props.okta ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
631
|
-
key: 4,
|
|
632
|
-
outline: props.ssoOutline,
|
|
633
|
-
"full-width": props.ssoAlign,
|
|
634
|
-
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
635
|
-
style: vue.normalizeStyle(props.ssoOutline ? "color: #FFB600;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #FFB600;" : ""}`),
|
|
636
|
-
icon: "sun",
|
|
637
|
-
class: vue.normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
638
|
-
value: props.ssoShowValue ? texts.value.oktaButton : void 0,
|
|
639
|
-
size: props.ssoSize,
|
|
640
|
-
onClick: _cache[8] || (_cache[8] = ($event) => vue.unref(sso2).okta.redirect())
|
|
641
|
-
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
642
|
-
[_directive_tooltip, !props.ssoShowValue ? texts.value.oktaButton : void 0]
|
|
643
|
-
]) : vue.createCommentVNode("", true),
|
|
644
|
-
props.facebook ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(vue$1.Btn), {
|
|
645
|
-
key: 5,
|
|
646
|
-
outline: props.ssoOutline,
|
|
647
|
-
"full-width": props.ssoAlign,
|
|
648
|
-
"align-txt": props.ssoAlign ? "start" : void 0,
|
|
649
|
-
style: vue.normalizeStyle(props.ssoOutline ? "color: #1877F3;" : `color: #FFFFFF; ${props.ssoBrandBackground ? "background: #1877F3;" : ""}`),
|
|
650
|
-
icon: "facebook",
|
|
651
|
-
class: vue.normalizeClass({ "px-075": props.ssoAlign ? "px-075" : "" }),
|
|
652
|
-
value: props.ssoShowValue ? texts.value.facebookButton : void 0,
|
|
653
|
-
size: props.ssoSize,
|
|
654
|
-
onClick: _cache[9] || (_cache[9] = ($event) => vue.unref(sso2).facebook.redirect())
|
|
655
|
-
}, null, 8, ["outline", "full-width", "align-txt", "style", "class", "value", "size"])), [
|
|
656
|
-
[_directive_tooltip, !props.ssoShowValue ? texts.value.facebookButton : void 0]
|
|
657
|
-
]) : vue.createCommentVNode("", true)
|
|
658
|
-
], 2),
|
|
659
|
-
vue.createElementVNode("div", _hoisted_5$2, [
|
|
660
|
-
error.value ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_6$2, vue.toDisplayString(error.value), 1)) : vue.createCommentVNode("", true)
|
|
661
|
-
])
|
|
662
|
-
])) : vue.createCommentVNode("", true)
|
|
663
|
-
], 34);
|
|
664
|
-
};
|
|
308
|
+
/**
|
|
309
|
+
* Create a new tenant (caller is auto-added as admin)
|
|
310
|
+
*/
|
|
311
|
+
async createTenant(data) {
|
|
312
|
+
return this.api.post("tenants/", data);
|
|
665
313
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const _hoisted_5$1 = { class: "txt20 bold txt-center mb-1" };
|
|
672
|
-
const _hoisted_6$1 = { class: "h-20px pt-075" };
|
|
673
|
-
const _hoisted_7$1 = {
|
|
674
|
-
key: 0,
|
|
675
|
-
class: "txt-center color-red txt-12"
|
|
676
|
-
};
|
|
677
|
-
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
678
|
-
__name: "ResetPasswordForm",
|
|
679
|
-
props: {
|
|
680
|
-
token: {},
|
|
681
|
-
showSuccess: { type: Boolean },
|
|
682
|
-
useHebrewDefaults: { type: Boolean, default: false },
|
|
683
|
-
texts: {}
|
|
684
|
-
},
|
|
685
|
-
emits: ["switchForm"],
|
|
686
|
-
setup(__props) {
|
|
687
|
-
const props = __props;
|
|
688
|
-
const { resetPassword } = useAuth();
|
|
689
|
-
const error = vue.ref("");
|
|
690
|
-
const internalSuccess = vue.ref(false);
|
|
691
|
-
const newPassword = vue.ref("");
|
|
692
|
-
const confirmPassword = vue.ref("");
|
|
693
|
-
const isValidToken = vue.computed(() => !!props.token);
|
|
694
|
-
const isSuccess = vue.computed(() => props.showSuccess || internalSuccess.value);
|
|
695
|
-
const texts = vue.computed(() => {
|
|
696
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
697
|
-
const hebrewDefaults = {
|
|
698
|
-
title: "איפוס סיסמה",
|
|
699
|
-
invalidLinkTitle: "קישור לא תקין",
|
|
700
|
-
invalidLinkMessage: "קישור איפוס הסיסמה לא תקין או פג תוקף",
|
|
701
|
-
newPasswordLabel: "סיסמה חדשה",
|
|
702
|
-
confirmPasswordLabel: "אימות סיסמה",
|
|
703
|
-
submitButton: "איפוס סיסמה",
|
|
704
|
-
backToLogin: "חזרה להתחברות",
|
|
705
|
-
passwordMismatchError: "הסיסמאות לא תואמות",
|
|
706
|
-
invalidTokenError: "אסימון לא תקין",
|
|
707
|
-
successTitle: "הסיסמה אופסה בהצלחה!",
|
|
708
|
-
successMessage: "הסיסמה שלכם אופסה. כעת תוכלו להתחברות עם הסיסמה החדשה.",
|
|
709
|
-
goToLogin: "מעבר להתחברות"
|
|
710
|
-
};
|
|
711
|
-
const englishDefaults = {
|
|
712
|
-
title: "Reset Password",
|
|
713
|
-
invalidLinkTitle: "Invalid Link",
|
|
714
|
-
invalidLinkMessage: "This reset link is invalid or has expired",
|
|
715
|
-
newPasswordLabel: "New Password",
|
|
716
|
-
confirmPasswordLabel: "Confirm Password",
|
|
717
|
-
submitButton: "Reset Password",
|
|
718
|
-
backToLogin: "Back to Login",
|
|
719
|
-
passwordMismatchError: "Passwords do not match",
|
|
720
|
-
invalidTokenError: "Invalid token",
|
|
721
|
-
successTitle: "Password Reset Successfully!",
|
|
722
|
-
successMessage: "Your password has been reset. You can now log in with your new password.",
|
|
723
|
-
goToLogin: "Go to Login"
|
|
724
|
-
};
|
|
725
|
-
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
726
|
-
return {
|
|
727
|
-
title: ((_a = props.texts) == null ? void 0 : _a.title) ?? defaults.title,
|
|
728
|
-
invalidLinkTitle: ((_b = props.texts) == null ? void 0 : _b.invalidLinkTitle) ?? defaults.invalidLinkTitle,
|
|
729
|
-
invalidLinkMessage: ((_c = props.texts) == null ? void 0 : _c.invalidLinkMessage) ?? defaults.invalidLinkMessage,
|
|
730
|
-
newPasswordLabel: ((_d = props.texts) == null ? void 0 : _d.newPasswordLabel) ?? defaults.newPasswordLabel,
|
|
731
|
-
confirmPasswordLabel: ((_e = props.texts) == null ? void 0 : _e.confirmPasswordLabel) ?? defaults.confirmPasswordLabel,
|
|
732
|
-
submitButton: ((_f = props.texts) == null ? void 0 : _f.submitButton) ?? defaults.submitButton,
|
|
733
|
-
backToLogin: ((_g = props.texts) == null ? void 0 : _g.backToLogin) ?? defaults.backToLogin,
|
|
734
|
-
passwordMismatchError: ((_h = props.texts) == null ? void 0 : _h.passwordMismatchError) ?? defaults.passwordMismatchError,
|
|
735
|
-
invalidTokenError: ((_i = props.texts) == null ? void 0 : _i.invalidTokenError) ?? defaults.invalidTokenError,
|
|
736
|
-
successTitle: ((_j = props.texts) == null ? void 0 : _j.successTitle) ?? defaults.successTitle,
|
|
737
|
-
successMessage: ((_k = props.texts) == null ? void 0 : _k.successMessage) ?? defaults.successMessage,
|
|
738
|
-
goToLogin: ((_l = props.texts) == null ? void 0 : _l.goToLogin) ?? defaults.goToLogin
|
|
739
|
-
};
|
|
740
|
-
});
|
|
741
|
-
const textDirection = vue.computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
742
|
-
async function handleResetPassword() {
|
|
743
|
-
if (newPassword.value !== confirmPassword.value) {
|
|
744
|
-
error.value = texts.value.passwordMismatchError;
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
if (!props.token) {
|
|
748
|
-
error.value = texts.value.invalidTokenError;
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
try {
|
|
752
|
-
await resetPassword(props.token, newPassword.value);
|
|
753
|
-
internalSuccess.value = true;
|
|
754
|
-
error.value = "";
|
|
755
|
-
} catch (err) {
|
|
756
|
-
error.value = err instanceof Error ? err.message : "Reset failed";
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
return (_ctx, _cache) => {
|
|
760
|
-
return !isValidToken.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
761
|
-
key: 0,
|
|
762
|
-
class: vue.normalizeClass(["txt-center", textDirection.value])
|
|
763
|
-
}, [
|
|
764
|
-
vue.createElementVNode("h1", _hoisted_1$6, vue.toDisplayString(texts.value.invalidLinkTitle), 1),
|
|
765
|
-
vue.createElementVNode("p", _hoisted_2$2, vue.toDisplayString(texts.value.invalidLinkMessage), 1),
|
|
766
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
767
|
-
value: texts.value.backToLogin,
|
|
768
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
769
|
-
}, null, 8, ["value"])
|
|
770
|
-
], 2)) : isSuccess.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
771
|
-
key: 1,
|
|
772
|
-
class: vue.normalizeClass(["txt-center", textDirection.value])
|
|
773
|
-
}, [
|
|
774
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
775
|
-
name: "check_circle",
|
|
776
|
-
size: "4",
|
|
777
|
-
class: "txt-green mb-1"
|
|
778
|
-
}),
|
|
779
|
-
vue.createElementVNode("h1", _hoisted_3$2, vue.toDisplayString(texts.value.successTitle), 1),
|
|
780
|
-
vue.createElementVNode("p", _hoisted_4$1, vue.toDisplayString(texts.value.successMessage), 1),
|
|
781
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
782
|
-
value: texts.value.goToLogin,
|
|
783
|
-
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
784
|
-
}, null, 8, ["value"])
|
|
785
|
-
], 2)) : (vue.openBlock(), vue.createElementBlock("form", {
|
|
786
|
-
key: 2,
|
|
787
|
-
class: vue.normalizeClass(textDirection.value),
|
|
788
|
-
onSubmit: vue.withModifiers(handleResetPassword, ["prevent"])
|
|
789
|
-
}, [
|
|
790
|
-
vue.createElementVNode("h1", _hoisted_5$1, vue.toDisplayString(texts.value.title), 1),
|
|
791
|
-
vue.createVNode(vue.unref(vue$1.PasswordInput), {
|
|
792
|
-
modelValue: newPassword.value,
|
|
793
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => newPassword.value = $event),
|
|
794
|
-
class: "mb-05",
|
|
795
|
-
label: texts.value.newPasswordLabel,
|
|
796
|
-
autocomplete: "new-password"
|
|
797
|
-
}, null, 8, ["modelValue", "label"]),
|
|
798
|
-
vue.createVNode(vue.unref(vue$1.PasswordInput), {
|
|
799
|
-
modelValue: confirmPassword.value,
|
|
800
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => confirmPassword.value = $event),
|
|
801
|
-
label: texts.value.confirmPasswordLabel,
|
|
802
|
-
autocomplete: "new-password"
|
|
803
|
-
}, null, 8, ["modelValue", "label"]),
|
|
804
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
805
|
-
type: "submit",
|
|
806
|
-
class: "w-100 mt-2",
|
|
807
|
-
value: texts.value.submitButton
|
|
808
|
-
}, null, 8, ["value"]),
|
|
809
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
810
|
-
thin: "",
|
|
811
|
-
flat: "",
|
|
812
|
-
class: "txt-12 mt-075 underline block",
|
|
813
|
-
value: texts.value.backToLogin,
|
|
814
|
-
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
815
|
-
}, null, 8, ["value"]),
|
|
816
|
-
vue.createElementVNode("div", _hoisted_6$1, [
|
|
817
|
-
error.value ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_7$1, vue.toDisplayString(error.value), 1)) : vue.createCommentVNode("", true)
|
|
818
|
-
])
|
|
819
|
-
], 34));
|
|
820
|
-
};
|
|
314
|
+
/**
|
|
315
|
+
* Update a tenant
|
|
316
|
+
*/
|
|
317
|
+
async updateTenant(tenantId, data) {
|
|
318
|
+
return this.api.put(`tenants/${tenantId}`, data);
|
|
821
319
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
});
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
emailRequiredError: "איימיל נדרש",
|
|
867
|
-
emailInvalidError: "יש להזין כתובת איימיל תקינה",
|
|
868
|
-
passwordRequiredError: "סיסמה נדרשת",
|
|
869
|
-
passwordTooShortError: "הסיסמה חייבת להיות לפחות 8 תווים",
|
|
870
|
-
passwordMismatchError: "הסיסמאות לא תואמות",
|
|
871
|
-
firstNameRequiredError: "שם פרטי נדרש",
|
|
872
|
-
lastNameRequiredError: "שם משפחה נדרש"
|
|
873
|
-
};
|
|
874
|
-
const englishDefaults = {
|
|
875
|
-
title: "Create Account",
|
|
876
|
-
firstNameLabel: "First Name",
|
|
877
|
-
lastNameLabel: "Last Name",
|
|
878
|
-
emailLabel: "Email",
|
|
879
|
-
passwordLabel: "Password",
|
|
880
|
-
confirmPasswordLabel: "Confirm Password",
|
|
881
|
-
signupButton: "Create Account",
|
|
882
|
-
alreadyHaveAccount: "Already have an account?",
|
|
883
|
-
// Validation errors
|
|
884
|
-
emailRequiredError: "Email is required",
|
|
885
|
-
emailInvalidError: "Please enter a valid email address",
|
|
886
|
-
passwordRequiredError: "Password is required",
|
|
887
|
-
passwordTooShortError: "Password must be at least 8 characters",
|
|
888
|
-
passwordMismatchError: "Passwords do not match",
|
|
889
|
-
firstNameRequiredError: "First name is required",
|
|
890
|
-
lastNameRequiredError: "Last name is required"
|
|
891
|
-
};
|
|
892
|
-
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults;
|
|
893
|
-
return {
|
|
894
|
-
title: props.texts.title || defaults.title,
|
|
895
|
-
firstNameLabel: props.texts.firstNameLabel || defaults.firstNameLabel,
|
|
896
|
-
lastNameLabel: props.texts.lastNameLabel || defaults.lastNameLabel,
|
|
897
|
-
emailLabel: props.texts.emailLabel || defaults.emailLabel,
|
|
898
|
-
passwordLabel: props.texts.passwordLabel || defaults.passwordLabel,
|
|
899
|
-
confirmPasswordLabel: props.texts.confirmPasswordLabel || defaults.confirmPasswordLabel,
|
|
900
|
-
signupButton: props.texts.signupButton || defaults.signupButton,
|
|
901
|
-
alreadyHaveAccount: props.texts.alreadyHaveAccount || defaults.alreadyHaveAccount,
|
|
902
|
-
// Validation errors
|
|
903
|
-
emailRequiredError: props.texts.emailRequiredError || defaults.emailRequiredError,
|
|
904
|
-
emailInvalidError: props.texts.emailInvalidError || defaults.emailInvalidError,
|
|
905
|
-
passwordRequiredError: props.texts.passwordRequiredError || defaults.passwordRequiredError,
|
|
906
|
-
passwordTooShortError: props.texts.passwordTooShortError || defaults.passwordTooShortError,
|
|
907
|
-
passwordMismatchError: props.texts.passwordMismatchError || defaults.passwordMismatchError,
|
|
908
|
-
firstNameRequiredError: props.texts.firstNameRequiredError || defaults.firstNameRequiredError,
|
|
909
|
-
lastNameRequiredError: props.texts.lastNameRequiredError || defaults.lastNameRequiredError
|
|
910
|
-
};
|
|
911
|
-
});
|
|
912
|
-
const textDirection = vue.computed(() => ({ "auth-rtl": props.useHebrewDefaults }));
|
|
913
|
-
function getDevError() {
|
|
914
|
-
switch (props.errorState) {
|
|
915
|
-
case "email-required":
|
|
916
|
-
return texts.value.emailRequiredError;
|
|
917
|
-
case "email-invalid":
|
|
918
|
-
return texts.value.emailInvalidError;
|
|
919
|
-
case "password-short":
|
|
920
|
-
return texts.value.passwordTooShortError;
|
|
921
|
-
case "password-mismatch":
|
|
922
|
-
return texts.value.passwordMismatchError;
|
|
923
|
-
case "name-required":
|
|
924
|
-
return props.showNames ? texts.value.firstNameRequiredError : null;
|
|
925
|
-
case "server-error":
|
|
926
|
-
return props.useHebrewDefaults ? "כתובת האימייל כבר קיימת או שגיאת שרת" : "Email already exists or server error";
|
|
927
|
-
default:
|
|
928
|
-
return null;
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
function validateForm() {
|
|
932
|
-
if (!form.value.email.trim()) {
|
|
933
|
-
return texts.value.emailRequiredError;
|
|
934
|
-
}
|
|
935
|
-
const emailRegex = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
|
|
936
|
-
if (!emailRegex.test(form.value.email)) {
|
|
937
|
-
return texts.value.emailInvalidError;
|
|
938
|
-
}
|
|
939
|
-
if (!form.value.password) {
|
|
940
|
-
return texts.value.passwordRequiredError;
|
|
941
|
-
}
|
|
942
|
-
if (form.value.password.length < 8) {
|
|
943
|
-
return texts.value.passwordTooShortError;
|
|
944
|
-
}
|
|
945
|
-
if (form.value.password !== form.value.confirmPassword) {
|
|
946
|
-
return texts.value.passwordMismatchError;
|
|
947
|
-
}
|
|
948
|
-
if (props.showNames) {
|
|
949
|
-
if (!form.value.first_name.trim()) {
|
|
950
|
-
return texts.value.firstNameRequiredError;
|
|
951
|
-
}
|
|
952
|
-
if (!form.value.last_name.trim()) {
|
|
953
|
-
return texts.value.lastNameRequiredError;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
return null;
|
|
957
|
-
}
|
|
958
|
-
async function handleSignup() {
|
|
959
|
-
if (props.errorState !== "normal") {
|
|
960
|
-
return;
|
|
961
|
-
}
|
|
962
|
-
internalError.value = "";
|
|
963
|
-
const validationError = validateForm();
|
|
964
|
-
if (validationError) {
|
|
965
|
-
internalError.value = validationError;
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
const { message, success } = await signup(form.value).catch((error2) => {
|
|
969
|
-
var _a, _b;
|
|
970
|
-
console.error(error2);
|
|
971
|
-
const errorMessage = (_b = (_a = error2.response) == null ? void 0 : _a.data) == null ? void 0 : _b.detail;
|
|
972
|
-
if (errorMessage == null ? void 0 : errorMessage.toLowerCase().includes("email")) {
|
|
973
|
-
return { success: false, message: "Email already exists or invalid" };
|
|
974
|
-
}
|
|
975
|
-
if (errorMessage == null ? void 0 : errorMessage.toLowerCase().includes("password")) {
|
|
976
|
-
return { success: false, message: "Password does not meet requirements" };
|
|
977
|
-
}
|
|
978
|
-
return { success: false, message: errorMessage || "Registration failed. Please try again." };
|
|
979
|
-
});
|
|
980
|
-
if (!success) {
|
|
981
|
-
internalError.value = message;
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
await login({ email: form.value.email, password: form.value.password });
|
|
985
|
-
}
|
|
986
|
-
return (_ctx, _cache) => {
|
|
987
|
-
return vue.openBlock(), vue.createElementBlock("form", {
|
|
988
|
-
class: vue.normalizeClass(textDirection.value),
|
|
989
|
-
onSubmit: vue.withModifiers(handleSignup, ["prevent"])
|
|
990
|
-
}, [
|
|
991
|
-
vue.createElementVNode("h1", _hoisted_1$5, vue.toDisplayString(texts.value.title), 1),
|
|
992
|
-
props.showNames ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.TextInput), {
|
|
993
|
-
key: 0,
|
|
994
|
-
modelValue: form.value.first_name,
|
|
995
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value.first_name = $event),
|
|
996
|
-
label: texts.value.firstNameLabel
|
|
997
|
-
}, null, 8, ["modelValue", "label"])) : vue.createCommentVNode("", true),
|
|
998
|
-
props.showNames ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.TextInput), {
|
|
999
|
-
key: 1,
|
|
1000
|
-
modelValue: form.value.last_name,
|
|
1001
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.last_name = $event),
|
|
1002
|
-
label: texts.value.lastNameLabel
|
|
1003
|
-
}, null, 8, ["modelValue", "label"])) : vue.createCommentVNode("", true),
|
|
1004
|
-
vue.createVNode(vue.unref(vue$1.TextInput), {
|
|
1005
|
-
modelValue: form.value.email,
|
|
1006
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => form.value.email = $event),
|
|
1007
|
-
type: "email",
|
|
1008
|
-
label: texts.value.emailLabel,
|
|
1009
|
-
autocomplete: "username"
|
|
1010
|
-
}, null, 8, ["modelValue", "label"]),
|
|
1011
|
-
vue.createVNode(vue.unref(vue$1.PasswordInput), {
|
|
1012
|
-
modelValue: form.value.password,
|
|
1013
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => form.value.password = $event),
|
|
1014
|
-
class: "mb-05",
|
|
1015
|
-
label: texts.value.passwordLabel
|
|
1016
|
-
}, null, 8, ["modelValue", "label"]),
|
|
1017
|
-
vue.createVNode(vue.unref(vue$1.PasswordInput), {
|
|
1018
|
-
modelValue: form.value.confirmPassword,
|
|
1019
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => form.value.confirmPassword = $event),
|
|
1020
|
-
label: texts.value.confirmPasswordLabel
|
|
1021
|
-
}, null, 8, ["modelValue", "label"]),
|
|
1022
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
1023
|
-
class: "w-100 mt-2",
|
|
1024
|
-
value: texts.value.signupButton,
|
|
1025
|
-
type: "submit"
|
|
1026
|
-
}, null, 8, ["value"]),
|
|
1027
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
1028
|
-
thin: "",
|
|
1029
|
-
flat: "",
|
|
1030
|
-
class: "txt-12 mt-075 underline block",
|
|
1031
|
-
value: texts.value.alreadyHaveAccount,
|
|
1032
|
-
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("switchForm", "login"))
|
|
1033
|
-
}, null, 8, ["value"]),
|
|
1034
|
-
vue.createElementVNode("div", _hoisted_2$1, [
|
|
1035
|
-
error.value ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3$1, vue.toDisplayString(error.value), 1)) : vue.createCommentVNode("", true)
|
|
1036
|
-
])
|
|
1037
|
-
], 34);
|
|
1038
|
-
};
|
|
320
|
+
/**
|
|
321
|
+
* Delete a tenant
|
|
322
|
+
*/
|
|
323
|
+
async deleteTenant(tenantId) {
|
|
324
|
+
return this.api.delete(`tenants/${tenantId}`);
|
|
325
|
+
}
|
|
326
|
+
// ============================================
|
|
327
|
+
// Tenant Member Methods
|
|
328
|
+
// ============================================
|
|
329
|
+
/**
|
|
330
|
+
* List members of a tenant
|
|
331
|
+
*/
|
|
332
|
+
async getTenantMembers(tenantId, status) {
|
|
333
|
+
return this.api.get(`tenants/${tenantId}/members`, { params: status ? { status } : void 0 });
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Add a member to a tenant by identity_id
|
|
337
|
+
*/
|
|
338
|
+
async addTenantMember(tenantId, data) {
|
|
339
|
+
return this.api.post(`tenants/${tenantId}/members`, data);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Update a tenant member's roles/status/metadata
|
|
343
|
+
*/
|
|
344
|
+
async updateTenantMember(tenantId, identityId, data) {
|
|
345
|
+
return this.api.put(`tenants/${tenantId}/members/${identityId}`, data);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Activate a pending membership
|
|
349
|
+
*/
|
|
350
|
+
async activateTenantMember(tenantId, identityId) {
|
|
351
|
+
return this.api.post(`tenants/${tenantId}/members/${identityId}/activate`, {});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Remove a member from a tenant
|
|
355
|
+
*/
|
|
356
|
+
async removeTenantMember(tenantId, identityId) {
|
|
357
|
+
return this.api.delete(`tenants/${tenantId}/members/${identityId}`);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* List available roles
|
|
361
|
+
*/
|
|
362
|
+
async getTenantRoles() {
|
|
363
|
+
return this.api.get("tenants/roles");
|
|
1039
364
|
}
|
|
1040
|
-
|
|
365
|
+
// ============================================
|
|
366
|
+
// Invitation Methods
|
|
367
|
+
// ============================================
|
|
368
|
+
/**
|
|
369
|
+
* Create an invitation for a new user to join a tenant
|
|
370
|
+
* Requires X-Tenant-ID header (set via setTenantId)
|
|
371
|
+
*/
|
|
372
|
+
async createInvitation(data) {
|
|
373
|
+
return this.api.post("invitations/", data);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Get invitation metadata by token (no auth required)
|
|
377
|
+
*/
|
|
378
|
+
async getInvitation(token) {
|
|
379
|
+
return this.api.get(`invitations/${token}`);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Accept an invitation — creates TenantMembership for the authenticated user
|
|
383
|
+
*/
|
|
384
|
+
async acceptInvitation(token, data) {
|
|
385
|
+
return this.api.post(`invitations/${token}/accept`, data ?? {});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
1041
388
|
const INTAKE_WORKFLOW_ID = "fdba1933-0964-4850-b52a-7a4324175790";
|
|
1042
389
|
const DEFAULT_AGENT_ID = "fdba1933-0964-4850-b52a-7a4324175790";
|
|
1043
390
|
const providers = {
|
|
@@ -1048,387 +395,6 @@ const providers = {
|
|
|
1048
395
|
okta: { name: "Okta", icon: "sun", color: "#FFB600" },
|
|
1049
396
|
facebook: { name: "Facebook", icon: "facebook", color: "#1877F3" }
|
|
1050
397
|
};
|
|
1051
|
-
const _hoisted_1$4 = { class: "flex justify-content-center align-items-center vh-100 px-1" };
|
|
1052
|
-
const _hoisted_2 = {
|
|
1053
|
-
key: 0,
|
|
1054
|
-
class: "flex column align-items-center gap-1"
|
|
1055
|
-
};
|
|
1056
|
-
const _hoisted_3 = { class: "mt-1" };
|
|
1057
|
-
const _hoisted_4 = { class: "mb-05 pb-0 mt-0 txt24 m_txt20" };
|
|
1058
|
-
const _hoisted_5 = { class: "opacity-7 txt-14" };
|
|
1059
|
-
const _hoisted_6 = {
|
|
1060
|
-
key: 1,
|
|
1061
|
-
class: "flex column align-items-center gap-1"
|
|
1062
|
-
};
|
|
1063
|
-
const _hoisted_7 = { class: "flex justify-content-center align-items-center mb-1" };
|
|
1064
|
-
const _hoisted_8 = { class: "relative" };
|
|
1065
|
-
const _hoisted_9 = {
|
|
1066
|
-
key: 0,
|
|
1067
|
-
class: "absolute flex justify-content-center align-items-center bg-white rounded",
|
|
1068
|
-
style: { "bottom": "-8px", "right": "-8px", "width": "40px", "height": "40px", "border": "3px solid white" }
|
|
1069
|
-
};
|
|
1070
|
-
const _hoisted_10 = { class: "mb-05 pb-0 mt-0 txt24 m_txt20" };
|
|
1071
|
-
const _hoisted_11 = { class: "opacity-7 txt-14 mb-1" };
|
|
1072
|
-
const _hoisted_12 = {
|
|
1073
|
-
key: 0,
|
|
1074
|
-
class: "bg-gray-light rounded p-1 mt-1"
|
|
1075
|
-
};
|
|
1076
|
-
const _hoisted_13 = { class: "flex column gap-05" };
|
|
1077
|
-
const _hoisted_14 = {
|
|
1078
|
-
key: 0,
|
|
1079
|
-
class: "flex align-items-center gap-05 justify-content-center"
|
|
1080
|
-
};
|
|
1081
|
-
const _hoisted_15 = { class: "txt-14 bold" };
|
|
1082
|
-
const _hoisted_16 = {
|
|
1083
|
-
key: 1,
|
|
1084
|
-
class: "flex align-items-center gap-05 justify-content-center"
|
|
1085
|
-
};
|
|
1086
|
-
const _hoisted_17 = { class: "txt-14 opacity-7" };
|
|
1087
|
-
const _hoisted_18 = {
|
|
1088
|
-
key: 2,
|
|
1089
|
-
class: "flex gap-05 justify-content-center mt-05"
|
|
1090
|
-
};
|
|
1091
|
-
const _hoisted_19 = {
|
|
1092
|
-
key: 2,
|
|
1093
|
-
class: "flex column align-items-center gap-1"
|
|
1094
|
-
};
|
|
1095
|
-
const _hoisted_20 = { class: "opacity-7 txt-14 mb-1" };
|
|
1096
|
-
const _hoisted_21 = { class: "flex gap-05 justify-content-center" };
|
|
1097
|
-
const timeout = 4e3;
|
|
1098
|
-
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
1099
|
-
__name: "Callback",
|
|
1100
|
-
setup(__props) {
|
|
1101
|
-
const isLoading = vue.ref(true);
|
|
1102
|
-
const error = vue.ref(null);
|
|
1103
|
-
const success = vue.ref(false);
|
|
1104
|
-
const isLinking = vue.ref(false);
|
|
1105
|
-
const provider = vue.ref(null);
|
|
1106
|
-
const authResponse = vue.ref(null);
|
|
1107
|
-
const { sso: sso2, user, accountInfo: accountInfo2 } = useAuth();
|
|
1108
|
-
const route = vueRouter.useRoute();
|
|
1109
|
-
const router2 = vueRouter.useRouter();
|
|
1110
|
-
const providerInfo = vue.computed(() => {
|
|
1111
|
-
if (provider.value === null) return null;
|
|
1112
|
-
return providers[provider.value];
|
|
1113
|
-
});
|
|
1114
|
-
async function linkCallback() {
|
|
1115
|
-
isLinking.value = true;
|
|
1116
|
-
const { redirect: redirect2 } = route.query;
|
|
1117
|
-
try {
|
|
1118
|
-
await sso2.handleLinkCallback();
|
|
1119
|
-
success.value = true;
|
|
1120
|
-
setTimeout(() => {
|
|
1121
|
-
const redirectPath = typeof redirect2 === "string" ? redirect2 : "/";
|
|
1122
|
-
router2.push(redirectPath);
|
|
1123
|
-
}, timeout);
|
|
1124
|
-
} catch (err) {
|
|
1125
|
-
const errorMessage = err instanceof Error ? err.message : "Failed to link account";
|
|
1126
|
-
error.value = errorMessage;
|
|
1127
|
-
} finally {
|
|
1128
|
-
isLoading.value = false;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
async function handleCallback() {
|
|
1132
|
-
var _a;
|
|
1133
|
-
const { state, redirect: redirect2 } = route.query;
|
|
1134
|
-
provider.value = sessionStorage.getItem(`oauth_provider:${state}`);
|
|
1135
|
-
console.log("[Callback] Query params:", { state, redirect: redirect2 });
|
|
1136
|
-
console.log("[Callback] Full route query:", route.query);
|
|
1137
|
-
try {
|
|
1138
|
-
const response = await sso2.handleCallback();
|
|
1139
|
-
if (response === null) {
|
|
1140
|
-
error.value = `Failed to authenticate with ${((_a = providerInfo.value) == null ? void 0 : _a.name) ?? "provider"}`;
|
|
1141
|
-
} else {
|
|
1142
|
-
authResponse.value = response;
|
|
1143
|
-
success.value = true;
|
|
1144
|
-
console.log("[Callback] Login successful, redirect param:", redirect2);
|
|
1145
|
-
setTimeout(() => {
|
|
1146
|
-
const redirectPath = typeof redirect2 === "string" ? redirect2 : "/";
|
|
1147
|
-
console.log("[Callback] Manual fallback redirecting to:", redirectPath);
|
|
1148
|
-
router2.push(redirectPath);
|
|
1149
|
-
}, timeout);
|
|
1150
|
-
}
|
|
1151
|
-
} catch (err) {
|
|
1152
|
-
const errorMessage = err instanceof Error ? err.message : "Authentication failed";
|
|
1153
|
-
error.value = errorMessage;
|
|
1154
|
-
} finally {
|
|
1155
|
-
isLoading.value = false;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
vue.onMounted(async () => {
|
|
1159
|
-
if (user.value) {
|
|
1160
|
-
await linkCallback();
|
|
1161
|
-
} else {
|
|
1162
|
-
await handleCallback();
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1165
|
-
return (_ctx, _cache) => {
|
|
1166
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
1167
|
-
vue.createVNode(vue.unref(vue$1.Card), { class: "p-2 txt-center w450px shadow" }, {
|
|
1168
|
-
default: vue.withCtx(() => {
|
|
1169
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1170
|
-
return [
|
|
1171
|
-
isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
1172
|
-
vue.createVNode(vue.unref(vue$1.Loading)),
|
|
1173
|
-
vue.createElementVNode("div", _hoisted_3, [
|
|
1174
|
-
vue.createElementVNode("h2", _hoisted_4, vue.toDisplayString(isLinking.value ? "Linking Account" : "Authenticating"), 1),
|
|
1175
|
-
vue.createElementVNode("p", _hoisted_5, " Please wait while we " + vue.toDisplayString(isLinking.value ? "link your" : "complete the") + " " + vue.toDisplayString(((_a = providerInfo.value) == null ? void 0 : _a.name) || "OAuth") + " " + vue.toDisplayString(isLinking.value ? "account" : "authentication") + ". ", 1)
|
|
1176
|
-
])
|
|
1177
|
-
])) : success.value && !error.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
|
|
1178
|
-
vue.createElementVNode("div", _hoisted_7, [
|
|
1179
|
-
vue.createElementVNode("div", _hoisted_8, [
|
|
1180
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1181
|
-
name: "check_circle",
|
|
1182
|
-
size: "5",
|
|
1183
|
-
class: "txt-green line-height-1"
|
|
1184
|
-
}),
|
|
1185
|
-
providerInfo.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9, [
|
|
1186
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1187
|
-
name: providerInfo.value.icon,
|
|
1188
|
-
size: "1.5",
|
|
1189
|
-
style: vue.normalizeStyle({ color: providerInfo.value.color })
|
|
1190
|
-
}, null, 8, ["name", "style"])
|
|
1191
|
-
])) : vue.createCommentVNode("", true)
|
|
1192
|
-
])
|
|
1193
|
-
]),
|
|
1194
|
-
vue.createElementVNode("div", null, [
|
|
1195
|
-
vue.createElementVNode("h2", _hoisted_10, vue.toDisplayString(isLinking.value ? "Account Linked!" : "Welcome Back!"), 1),
|
|
1196
|
-
vue.createElementVNode("p", _hoisted_11, vue.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),
|
|
1197
|
-
vue.unref(user) || vue.unref(accountInfo2) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
|
|
1198
|
-
vue.createElementVNode("div", _hoisted_13, [
|
|
1199
|
-
((_d = vue.unref(user)) == null ? void 0 : _d.name) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
|
|
1200
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1201
|
-
name: "person",
|
|
1202
|
-
size: "1.2",
|
|
1203
|
-
class: "opacity-7"
|
|
1204
|
-
}),
|
|
1205
|
-
vue.createElementVNode("span", _hoisted_15, vue.toDisplayString(vue.unref(user).name), 1)
|
|
1206
|
-
])) : vue.createCommentVNode("", true),
|
|
1207
|
-
((_e = vue.unref(user)) == null ? void 0 : _e.email) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
|
|
1208
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1209
|
-
name: "email",
|
|
1210
|
-
size: "1.2",
|
|
1211
|
-
class: "opacity-7"
|
|
1212
|
-
}),
|
|
1213
|
-
vue.createElementVNode("span", _hoisted_17, vue.toDisplayString(vue.unref(user).email), 1)
|
|
1214
|
-
])) : vue.createCommentVNode("", true),
|
|
1215
|
-
((_f = vue.unref(accountInfo2)) == null ? void 0 : _f.authentication_methods) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18, [
|
|
1216
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(accountInfo2).authentication_methods, (method) => {
|
|
1217
|
-
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
1218
|
-
key: method.id,
|
|
1219
|
-
name: method.type === "sso" ? method.provider || "link" : "password",
|
|
1220
|
-
size: "1.2",
|
|
1221
|
-
class: "opacity-5"
|
|
1222
|
-
}, null, 8, ["name"]);
|
|
1223
|
-
}), 128))
|
|
1224
|
-
])) : vue.createCommentVNode("", true)
|
|
1225
|
-
])
|
|
1226
|
-
])) : vue.createCommentVNode("", true),
|
|
1227
|
-
_cache[0] || (_cache[0] = vue.createElementVNode("p", { class: "txt-12 opacity-5 mt-1" }, " Redirecting you to home... ", -1))
|
|
1228
|
-
])
|
|
1229
|
-
])) : error.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_19, [
|
|
1230
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1231
|
-
name: "error",
|
|
1232
|
-
size: "5",
|
|
1233
|
-
class: "txt-red mb-1 line-height-1"
|
|
1234
|
-
}),
|
|
1235
|
-
vue.createElementVNode("div", null, [
|
|
1236
|
-
_cache[1] || (_cache[1] = vue.createElementVNode("h2", { class: "mb-05 pb-0 mt-0 txt24 m_txt20" }, " Authentication Failed ", -1)),
|
|
1237
|
-
vue.createElementVNode("p", _hoisted_20, vue.toDisplayString(error.value), 1),
|
|
1238
|
-
_cache[2] || (_cache[2] = vue.createElementVNode("div", { class: "bg-red-light rounded p-1 mt-1 mb-1" }, [
|
|
1239
|
-
vue.createElementVNode("p", { class: "txt-12 opacity-7" }, " This could happen if: "),
|
|
1240
|
-
vue.createElementVNode("ul", {
|
|
1241
|
-
class: "txt-12 opacity-7 txt-start mt-05",
|
|
1242
|
-
style: { "list-style": "none", "padding-left": "0" }
|
|
1243
|
-
}, [
|
|
1244
|
-
vue.createElementVNode("li", { class: "mb-025" }, " • The authorization was cancelled "),
|
|
1245
|
-
vue.createElementVNode("li", { class: "mb-025" }, " • The state parameter was invalid "),
|
|
1246
|
-
vue.createElementVNode("li", { class: "mb-025" }, " • The OAuth provider denied access "),
|
|
1247
|
-
vue.createElementVNode("li", { class: "mb-025" }, " • Network connectivity issues ")
|
|
1248
|
-
])
|
|
1249
|
-
], -1)),
|
|
1250
|
-
vue.createElementVNode("div", _hoisted_21, [
|
|
1251
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
1252
|
-
outline: "",
|
|
1253
|
-
value: "Try Again",
|
|
1254
|
-
to: "/login"
|
|
1255
|
-
}),
|
|
1256
|
-
vue.createVNode(vue.unref(vue$1.Btn), {
|
|
1257
|
-
value: "Go Home",
|
|
1258
|
-
to: "/"
|
|
1259
|
-
})
|
|
1260
|
-
])
|
|
1261
|
-
])
|
|
1262
|
-
])) : vue.createCommentVNode("", true)
|
|
1263
|
-
];
|
|
1264
|
-
}),
|
|
1265
|
-
_: 1
|
|
1266
|
-
})
|
|
1267
|
-
]);
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
const _hoisted_1$3 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1272
|
-
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
1273
|
-
__name: "ForgotPasswordPage",
|
|
1274
|
-
props: {
|
|
1275
|
-
texts: {},
|
|
1276
|
-
cardWidth: { default: "450px" },
|
|
1277
|
-
cardShadow: { type: Boolean, default: true }
|
|
1278
|
-
},
|
|
1279
|
-
setup(__props) {
|
|
1280
|
-
const router2 = vueRouter.useRouter();
|
|
1281
|
-
function switchForm(form) {
|
|
1282
|
-
if (form === "login") {
|
|
1283
|
-
router2.push("/login");
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
return (_ctx, _cache) => {
|
|
1287
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
1288
|
-
vue.createVNode(vue.unref(vue$1.Card), {
|
|
1289
|
-
class: vue.normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1290
|
-
style: vue.normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1291
|
-
}, {
|
|
1292
|
-
default: vue.withCtx(() => [
|
|
1293
|
-
vue.createVNode(_sfc_main$8, {
|
|
1294
|
-
texts: _ctx.texts,
|
|
1295
|
-
onSwitchForm: switchForm
|
|
1296
|
-
}, null, 8, ["texts"])
|
|
1297
|
-
]),
|
|
1298
|
-
_: 1
|
|
1299
|
-
}, 8, ["class", "style"])
|
|
1300
|
-
]);
|
|
1301
|
-
};
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
const _hoisted_1$2 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1305
|
-
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
1306
|
-
__name: "LoginPage",
|
|
1307
|
-
props: {
|
|
1308
|
-
texts: {},
|
|
1309
|
-
github: { type: Boolean, default: true },
|
|
1310
|
-
google: { type: Boolean, default: true },
|
|
1311
|
-
microsoft: { type: Boolean, default: true },
|
|
1312
|
-
apple: { type: Boolean, default: true },
|
|
1313
|
-
okta: { type: Boolean, default: true },
|
|
1314
|
-
facebook: { type: Boolean, default: true },
|
|
1315
|
-
ssoOutline: { type: Boolean, default: true },
|
|
1316
|
-
ssoShowValue: { type: Boolean, default: true },
|
|
1317
|
-
ssoBrandBackground: { type: Boolean, default: true },
|
|
1318
|
-
showForgotPassword: { type: Boolean, default: true },
|
|
1319
|
-
showSignupButton: { type: Boolean, default: true },
|
|
1320
|
-
cardWidth: { default: "450px" },
|
|
1321
|
-
cardShadow: { type: Boolean, default: true }
|
|
1322
|
-
},
|
|
1323
|
-
setup(__props) {
|
|
1324
|
-
const router2 = vueRouter.useRouter();
|
|
1325
|
-
function switchForm(form) {
|
|
1326
|
-
if (form === "signup") {
|
|
1327
|
-
router2.push("/signup");
|
|
1328
|
-
} else if (form === "forgot-password") {
|
|
1329
|
-
router2.push("/forgot-password");
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
return (_ctx, _cache) => {
|
|
1333
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
1334
|
-
vue.createVNode(vue.unref(vue$1.Card), {
|
|
1335
|
-
class: vue.normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1336
|
-
style: vue.normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1337
|
-
}, {
|
|
1338
|
-
default: vue.withCtx(() => [
|
|
1339
|
-
vue.createVNode(_sfc_main$7, {
|
|
1340
|
-
texts: _ctx.texts,
|
|
1341
|
-
github: _ctx.github,
|
|
1342
|
-
google: _ctx.google,
|
|
1343
|
-
microsoft: _ctx.microsoft,
|
|
1344
|
-
apple: _ctx.apple,
|
|
1345
|
-
okta: _ctx.okta,
|
|
1346
|
-
facebook: _ctx.facebook,
|
|
1347
|
-
"sso-outline": _ctx.ssoOutline,
|
|
1348
|
-
"sso-show-value": _ctx.ssoShowValue,
|
|
1349
|
-
"sso-brand-background": _ctx.ssoBrandBackground,
|
|
1350
|
-
"show-forgot-password": _ctx.showForgotPassword,
|
|
1351
|
-
"show-signup-button": _ctx.showSignupButton,
|
|
1352
|
-
onSwitchForm: switchForm
|
|
1353
|
-
}, null, 8, ["texts", "github", "google", "microsoft", "apple", "okta", "facebook", "sso-outline", "sso-show-value", "sso-brand-background", "show-forgot-password", "show-signup-button"])
|
|
1354
|
-
]),
|
|
1355
|
-
_: 1
|
|
1356
|
-
}, 8, ["class", "style"])
|
|
1357
|
-
]);
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1361
|
-
const _hoisted_1$1 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1362
|
-
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
1363
|
-
__name: "ResetPasswordPage",
|
|
1364
|
-
props: {
|
|
1365
|
-
texts: {},
|
|
1366
|
-
cardWidth: { default: "450px" },
|
|
1367
|
-
cardShadow: { type: Boolean, default: true }
|
|
1368
|
-
},
|
|
1369
|
-
setup(__props) {
|
|
1370
|
-
const router2 = vueRouter.useRouter();
|
|
1371
|
-
const route = vueRouter.useRoute();
|
|
1372
|
-
const token = vue.computed(() => route.query.token);
|
|
1373
|
-
function switchForm(form) {
|
|
1374
|
-
if (form === "login") {
|
|
1375
|
-
router2.push("/login");
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
return (_ctx, _cache) => {
|
|
1379
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
|
|
1380
|
-
vue.createVNode(vue.unref(vue$1.Card), {
|
|
1381
|
-
class: vue.normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1382
|
-
style: vue.normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1383
|
-
}, {
|
|
1384
|
-
default: vue.withCtx(() => [
|
|
1385
|
-
vue.createVNode(_sfc_main$6, {
|
|
1386
|
-
texts: _ctx.texts,
|
|
1387
|
-
token: token.value,
|
|
1388
|
-
onSwitchForm: switchForm
|
|
1389
|
-
}, null, 8, ["texts", "token"])
|
|
1390
|
-
]),
|
|
1391
|
-
_: 1
|
|
1392
|
-
}, 8, ["class", "style"])
|
|
1393
|
-
]);
|
|
1394
|
-
};
|
|
1395
|
-
}
|
|
1396
|
-
});
|
|
1397
|
-
const _hoisted_1 = { class: "flex justify-content-center align-items-center min-vh-100 px-1 py-2" };
|
|
1398
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
1399
|
-
__name: "SignupPage",
|
|
1400
|
-
props: {
|
|
1401
|
-
texts: {},
|
|
1402
|
-
showNames: { type: Boolean, default: true },
|
|
1403
|
-
cardWidth: { default: "450px" },
|
|
1404
|
-
cardShadow: { type: Boolean, default: true }
|
|
1405
|
-
},
|
|
1406
|
-
setup(__props) {
|
|
1407
|
-
const router2 = vueRouter.useRouter();
|
|
1408
|
-
function switchForm(form) {
|
|
1409
|
-
if (form === "login") {
|
|
1410
|
-
router2.push("/login");
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
return (_ctx, _cache) => {
|
|
1414
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
1415
|
-
vue.createVNode(vue.unref(vue$1.Card), {
|
|
1416
|
-
class: vue.normalizeClass([{ shadow: _ctx.cardShadow }, "p-2"]),
|
|
1417
|
-
style: vue.normalizeStyle({ width: _ctx.cardWidth, maxWidth: "100%" })
|
|
1418
|
-
}, {
|
|
1419
|
-
default: vue.withCtx(() => [
|
|
1420
|
-
vue.createVNode(_sfc_main$5, {
|
|
1421
|
-
texts: _ctx.texts,
|
|
1422
|
-
"show-names": _ctx.showNames,
|
|
1423
|
-
onSwitchForm: switchForm
|
|
1424
|
-
}, null, 8, ["texts", "show-names"])
|
|
1425
|
-
]),
|
|
1426
|
-
_: 1
|
|
1427
|
-
}, 8, ["class", "style"])
|
|
1428
|
-
]);
|
|
1429
|
-
};
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
398
|
function getRedirectUrl(router2, config) {
|
|
1433
399
|
const redirect2 = router2.currentRoute.value.query[config.queryKey];
|
|
1434
400
|
return redirect2 || config.fallback;
|
|
@@ -1652,7 +618,7 @@ function createSSOProvider(config) {
|
|
|
1652
618
|
const auth = getAuthApi();
|
|
1653
619
|
const redirectUri = options.redirectUri ?? getDefaultRedirectUri();
|
|
1654
620
|
const state = options.state ?? generateState();
|
|
1655
|
-
const
|
|
621
|
+
const timeout = options.popupTimeout ?? 9e4;
|
|
1656
622
|
if (typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
|
|
1657
623
|
const currentParams = queryParams();
|
|
1658
624
|
const redirectUrl = currentParams.redirect;
|
|
@@ -1675,7 +641,7 @@ function createSSOProvider(config) {
|
|
|
1675
641
|
if (!popupWindow) {
|
|
1676
642
|
throw new PopupBlockedError();
|
|
1677
643
|
}
|
|
1678
|
-
const result = await waitForPopupCallback(popupWindow, config.id,
|
|
644
|
+
const result = await waitForPopupCallback(popupWindow, config.id, timeout);
|
|
1679
645
|
return auth.loginWithSSO(config.id, {
|
|
1680
646
|
code: result.code,
|
|
1681
647
|
state: result.state ?? generateState()
|
|
@@ -2244,6 +1210,60 @@ function useAuth() {
|
|
|
2244
1210
|
function getCurrentTenant() {
|
|
2245
1211
|
return currentTenant.value;
|
|
2246
1212
|
}
|
|
1213
|
+
async function createTenant(data) {
|
|
1214
|
+
const { data: tenant } = await api.createTenant(data);
|
|
1215
|
+
await loadTenants();
|
|
1216
|
+
return tenant;
|
|
1217
|
+
}
|
|
1218
|
+
async function updateTenant(tenantId, data) {
|
|
1219
|
+
const { data: tenant } = await api.updateTenant(tenantId, data);
|
|
1220
|
+
await loadTenants();
|
|
1221
|
+
return tenant;
|
|
1222
|
+
}
|
|
1223
|
+
async function deleteTenant(tenantId) {
|
|
1224
|
+
var _a;
|
|
1225
|
+
await api.deleteTenant(tenantId);
|
|
1226
|
+
if (((_a = currentTenant.value) == null ? void 0 : _a.id) === tenantId) {
|
|
1227
|
+
currentTenant.value = null;
|
|
1228
|
+
api.setTenantId(null);
|
|
1229
|
+
}
|
|
1230
|
+
await loadTenants();
|
|
1231
|
+
}
|
|
1232
|
+
async function getTenantMembers(tenantId, status) {
|
|
1233
|
+
const { data } = await api.getTenantMembers(tenantId, status);
|
|
1234
|
+
return data;
|
|
1235
|
+
}
|
|
1236
|
+
async function addTenantMember(tenantId, member) {
|
|
1237
|
+
const { data } = await api.addTenantMember(tenantId, member);
|
|
1238
|
+
return data;
|
|
1239
|
+
}
|
|
1240
|
+
async function updateTenantMember(tenantId, identityId, updates) {
|
|
1241
|
+
const { data } = await api.updateTenantMember(tenantId, identityId, updates);
|
|
1242
|
+
return data;
|
|
1243
|
+
}
|
|
1244
|
+
async function activateTenantMember(tenantId, identityId) {
|
|
1245
|
+
const { data } = await api.activateTenantMember(tenantId, identityId);
|
|
1246
|
+
return data;
|
|
1247
|
+
}
|
|
1248
|
+
async function removeTenantMember(tenantId, identityId) {
|
|
1249
|
+
await api.removeTenantMember(tenantId, identityId);
|
|
1250
|
+
}
|
|
1251
|
+
async function getTenantRoles() {
|
|
1252
|
+
const { data } = await api.getTenantRoles();
|
|
1253
|
+
return data;
|
|
1254
|
+
}
|
|
1255
|
+
async function createInvitation(data) {
|
|
1256
|
+
const { data: invitation } = await api.createInvitation(data);
|
|
1257
|
+
return invitation;
|
|
1258
|
+
}
|
|
1259
|
+
async function getInvitation(token) {
|
|
1260
|
+
const { data } = await api.getInvitation(token);
|
|
1261
|
+
return data;
|
|
1262
|
+
}
|
|
1263
|
+
async function acceptInvitation(token, data) {
|
|
1264
|
+
await api.acceptInvitation(token, data);
|
|
1265
|
+
await checkAuth();
|
|
1266
|
+
}
|
|
2247
1267
|
async function signup(newUser) {
|
|
2248
1268
|
const hasPassword = newUser.password !== void 0 && newUser.password.length > 0;
|
|
2249
1269
|
if (hasPassword && newUser.password !== newUser.confirmPassword) {
|
|
@@ -2380,7 +1400,22 @@ function useAuth() {
|
|
|
2380
1400
|
// Multi-Tenancy Actions
|
|
2381
1401
|
loadTenants,
|
|
2382
1402
|
setTenant,
|
|
2383
|
-
switchTenant
|
|
1403
|
+
switchTenant,
|
|
1404
|
+
// Tenant CRUD (requires tenancy: true)
|
|
1405
|
+
createTenant,
|
|
1406
|
+
updateTenant,
|
|
1407
|
+
deleteTenant,
|
|
1408
|
+
// Tenant Members
|
|
1409
|
+
getTenantMembers,
|
|
1410
|
+
addTenantMember,
|
|
1411
|
+
updateTenantMember,
|
|
1412
|
+
activateTenantMember,
|
|
1413
|
+
removeTenantMember,
|
|
1414
|
+
getTenantRoles,
|
|
1415
|
+
// Invitations
|
|
1416
|
+
createInvitation,
|
|
1417
|
+
getInvitation,
|
|
1418
|
+
acceptInvitation
|
|
2384
1419
|
};
|
|
2385
1420
|
}
|
|
2386
1421
|
const useAuth$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -2451,58 +1486,6 @@ const router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
2451
1486
|
composeGuards,
|
|
2452
1487
|
resetAuthState
|
|
2453
1488
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2454
|
-
function createAuthRoutes(config = {}) {
|
|
2455
|
-
const {
|
|
2456
|
-
basePath = "",
|
|
2457
|
-
namePrefix = "",
|
|
2458
|
-
routeNames = {},
|
|
2459
|
-
layout
|
|
2460
|
-
} = config;
|
|
2461
|
-
const createRouteName = (name) => namePrefix ? `${namePrefix}${name}` : name;
|
|
2462
|
-
const routes = [
|
|
2463
|
-
{
|
|
2464
|
-
path: `${basePath}/login`,
|
|
2465
|
-
name: routeNames.login || createRouteName("Login"),
|
|
2466
|
-
component: () => Promise.resolve().then(() => require("./LoginPage-hv1wc54S.cjs")),
|
|
2467
|
-
meta: { requiresAuth: false }
|
|
2468
|
-
},
|
|
2469
|
-
{
|
|
2470
|
-
path: `${basePath}/signup`,
|
|
2471
|
-
name: routeNames.signup || createRouteName("Signup"),
|
|
2472
|
-
component: () => Promise.resolve().then(() => require("./SignupPage-m36w9PLJ.cjs")),
|
|
2473
|
-
meta: { requiresAuth: false }
|
|
2474
|
-
},
|
|
2475
|
-
{
|
|
2476
|
-
path: `${basePath}/forgot-password`,
|
|
2477
|
-
name: routeNames.forgotPassword || createRouteName("ForgotPassword"),
|
|
2478
|
-
component: () => Promise.resolve().then(() => require("./ForgotPasswordPage-BV9tyhHl.cjs")),
|
|
2479
|
-
meta: { requiresAuth: false }
|
|
2480
|
-
},
|
|
2481
|
-
{
|
|
2482
|
-
path: `${basePath}/reset-password`,
|
|
2483
|
-
name: routeNames.resetPassword || createRouteName("ResetPassword"),
|
|
2484
|
-
component: () => Promise.resolve().then(() => require("./ResetPasswordPage-COPrJmW8.cjs")),
|
|
2485
|
-
meta: { requiresAuth: false }
|
|
2486
|
-
},
|
|
2487
|
-
{
|
|
2488
|
-
path: `${basePath}/callback`,
|
|
2489
|
-
name: routeNames.callback || createRouteName("AuthCallback"),
|
|
2490
|
-
component: () => Promise.resolve().then(() => require("./Callback-BHqVaZZm.cjs")),
|
|
2491
|
-
meta: { requiresAuth: false }
|
|
2492
|
-
}
|
|
2493
|
-
];
|
|
2494
|
-
if (layout) {
|
|
2495
|
-
return [{
|
|
2496
|
-
path: basePath,
|
|
2497
|
-
component: layout,
|
|
2498
|
-
children: routes.map((route) => ({
|
|
2499
|
-
...route,
|
|
2500
|
-
path: route.path.replace(basePath, "")
|
|
2501
|
-
}))
|
|
2502
|
-
}];
|
|
2503
|
-
}
|
|
2504
|
-
return routes;
|
|
2505
|
-
}
|
|
2506
1489
|
function createAuthGuard(config = {}) {
|
|
2507
1490
|
const { redirectTo = "/" } = config;
|
|
2508
1491
|
return async (to, _from, next) => {
|
|
@@ -2517,22 +1500,13 @@ function createAuthGuard(config = {}) {
|
|
|
2517
1500
|
}
|
|
2518
1501
|
exports.AuthApi = AuthApi;
|
|
2519
1502
|
exports.AuthState = AuthState;
|
|
2520
|
-
exports.Callback = _sfc_main$4;
|
|
2521
1503
|
exports.DEFAULT_AGENT_ID = DEFAULT_AGENT_ID;
|
|
2522
1504
|
exports.DEFAULT_REDIRECT_CONFIG = DEFAULT_REDIRECT_CONFIG;
|
|
2523
|
-
exports.ForgotPasswordForm = _sfc_main$8;
|
|
2524
|
-
exports.ForgotPasswordPage = _sfc_main$3;
|
|
2525
1505
|
exports.INTAKE_WORKFLOW_ID = INTAKE_WORKFLOW_ID;
|
|
2526
|
-
exports.LoginForm = _sfc_main$7;
|
|
2527
|
-
exports.LoginPage = _sfc_main$2;
|
|
2528
1506
|
exports.PopupBlockedError = PopupBlockedError;
|
|
2529
1507
|
exports.PopupClosedError = PopupClosedError;
|
|
2530
1508
|
exports.PopupTimeoutError = PopupTimeoutError;
|
|
2531
|
-
exports.ResetPasswordForm = _sfc_main$6;
|
|
2532
|
-
exports.ResetPasswordPage = _sfc_main$1;
|
|
2533
1509
|
exports.SSOError = SSOError;
|
|
2534
|
-
exports.SignupForm = _sfc_main$5;
|
|
2535
|
-
exports.SignupPage = _sfc_main;
|
|
2536
1510
|
exports.StateMismatchError = StateMismatchError;
|
|
2537
1511
|
exports.accountToUser = accountToUser;
|
|
2538
1512
|
exports.authGuard = authGuard;
|
|
@@ -2540,7 +1514,6 @@ exports.buildLoginQuery = buildLoginQuery;
|
|
|
2540
1514
|
exports.composeGuards = composeGuards;
|
|
2541
1515
|
exports.createAuth = createAuth;
|
|
2542
1516
|
exports.createAuthGuard = createAuthGuard;
|
|
2543
|
-
exports.createAuthRoutes = createAuthRoutes;
|
|
2544
1517
|
exports.getAllSSOProviders = getAllSSOProviders;
|
|
2545
1518
|
exports.getRedirectConfig = getRedirectConfig;
|
|
2546
1519
|
exports.getRedirectUrl = getRedirectUrl;
|