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