@fishawack/lab-velocity 1.11.1 → 2.0.0-beta.2
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 +13 -7
- package/_Build/vue/components/Icon.vue +33 -0
- package/_Build/vue/components/Svg.vue +45 -0
- package/{basic → _Build/vue/components/basic}/Button.vue +16 -18
- package/{basic → _Build/vue/components/basic}/link.vue +8 -7
- package/{form → _Build/vue/components/form}/Cascader.vue +13 -13
- package/{form → _Build/vue/components/form}/CheckboxGroup.vue +28 -6
- package/{form → _Build/vue/components/form}/DatePicker.vue +23 -7
- package/{form → _Build/vue/components/form}/InputNumber.vue +1 -2
- package/{form → _Build/vue/components/form}/Select.vue +8 -9
- package/{form → _Build/vue/components/form}/Switch.vue +2 -2
- package/{form → _Build/vue/components/form}/Upload.vue +4 -6
- package/{form → _Build/vue/components/form}/Wysiwyg.vue +14 -14
- package/_Build/vue/components/form/Wysiwyg2.vue +577 -0
- package/{form → _Build/vue/components/form}/basic.vue +25 -7
- package/{form → _Build/vue/components/form}/file.vue +1 -1
- package/{form → _Build/vue/components/form}/input.js +2 -2
- package/{form → _Build/vue/components/form}/input.vue +31 -11
- package/{layout → _Build/vue/components/layout}/Alert.vue +10 -10
- package/_Build/vue/components/layout/Footer.vue +50 -0
- package/{layout → _Build/vue/components/layout}/Header.vue +5 -7
- package/_Build/vue/components/layout/Loader.vue +59 -0
- package/{layout → _Build/vue/components/layout}/Tooltip.vue +12 -12
- package/{layout → _Build/vue/components/layout}/pageTitle.vue +4 -4
- package/{layout → _Build/vue/components/layout}/sideBar.vue +4 -6
- package/{navigation → _Build/vue/components/navigation}/Breadcrumbs.vue +15 -10
- package/{navigation → _Build/vue/components/navigation}/BreadcrumbsItem.vue +6 -6
- package/_Build/vue/components/navigation/Menu.vue +14 -0
- package/_Build/vue/components/navigation/MenuItem.vue +20 -0
- package/_Build/vue/components/navigation/MenuItemGroup.vue +20 -0
- package/_Build/vue/components/navigation/SubMenu.vue +20 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +251 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +62 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +98 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +90 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +173 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +262 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +36 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +112 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +103 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +112 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +169 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +120 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +36 -0
- package/{AuthModule → _Build/vue/modules/AuthModule}/components/AuthModal.vue +30 -35
- package/_Build/vue/modules/AuthModule/components/Chip.vue +70 -0
- package/_Build/vue/modules/AuthModule/components/Chips.vue +26 -0
- package/_Build/vue/modules/AuthModule/components/FormRole.vue +115 -0
- package/_Build/vue/modules/AuthModule/components/VBreadcrumbs.vue +32 -0
- package/_Build/vue/modules/AuthModule/components/VFormFooter.vue +46 -0
- package/_Build/vue/modules/AuthModule/components/VPageHeader.vue +38 -0
- package/_Build/vue/modules/AuthModule/components/VPasswordValidation.vue +106 -0
- package/_Build/vue/modules/AuthModule/components/VRoleLegend.vue +43 -0
- package/_Build/vue/modules/AuthModule/components/VTable.vue +127 -0
- package/_Build/vue/modules/AuthModule/components/VTableSorter.vue +240 -0
- package/_Build/vue/modules/AuthModule/js/FakeAPI.js +78 -0
- package/_Build/vue/modules/AuthModule/js/axios.js +62 -0
- package/_Build/vue/modules/AuthModule/js/router.js +295 -0
- package/_Build/vue/modules/AuthModule/js/store.js +62 -0
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/account-exists.vue +5 -7
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/change-password.vue +28 -25
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/container.vue +4 -8
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/expired-reset.vue +13 -11
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/expired-verification.vue +12 -12
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/force-reset.vue +36 -26
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/forgot.vue +11 -7
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/login.vue +20 -15
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/logincallback.vue +5 -10
- package/_Build/vue/modules/AuthModule/routes/loginheadless.vue +21 -0
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/loginsso.vue +32 -25
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/logout.vue +6 -6
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +27 -0
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/register.vue +43 -25
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/reset.vue +24 -14
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/success-forgot.vue +14 -12
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/success-reset.vue +4 -4
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/success-verify.vue +10 -7
- package/{AuthModule → _Build/vue/modules/AuthModule}/routes/verify.vue +15 -12
- package/_base.scss +1 -1
- package/_defaults.scss +2 -3
- package/_variables.scss +16 -18
- package/general.scss +1 -2
- package/index.js +38 -30
- package/package.json +103 -102
- package/vendor.scss +2 -2
- package/AuthModule/components/VPasswordValidation.vue +0 -66
- package/AuthModule/js/AuthAxios.js +0 -59
- package/AuthModule/js/AuthRoutes.js +0 -186
- package/AuthModule/js/AuthStore.js +0 -99
- package/AuthModule/js/FakeAPI.js +0 -84
- package/AuthModule/routes/loginheadless.vue +0 -16
- package/Icon.vue +0 -33
- package/Svg.vue +0 -40
- package/components/_alert.scss +0 -5
- package/components/_basic.scss +0 -54
- package/components/_breadcrumbs.scss +0 -40
- package/components/_button.scss +0 -305
- package/components/_cascader.scss +0 -12
- package/components/_checkbox.scss +0 -40
- package/components/_collapse.scss +0 -25
- package/components/_datepicker.scss +0 -51
- package/components/_footer.scss +0 -46
- package/components/_form.scss +0 -22
- package/components/_header.scss +0 -55
- package/components/_icon.scss +0 -24
- package/components/_input.scss +0 -0
- package/components/_inputNumber.scss +0 -21
- package/components/_link.scss +0 -44
- package/components/_loader.scss +0 -44
- package/components/_menu.scss +0 -112
- package/components/_pageTitle.scss +0 -8
- package/components/_select.scss +0 -28
- package/components/_sidebar.scss +0 -57
- package/components/_switch.scss +0 -14
- package/components/_table.scss +0 -20
- package/components/_tooltip.scss +0 -4
- package/components/_typography.scss +0 -153
- package/components/_upload.scss +0 -15
- package/components/_wysiwyg.scss +0 -6
- package/components/_wysiwyg2.scss +0 -136
- package/form/Wysiwyg2.vue +0 -278
- package/layout/Footer.vue +0 -35
- package/layout/Loader.vue +0 -39
- package/modules/_AuthModule.scss +0 -209
- package/modules/_AuthVariables.scss +0 -7
- package/modules/_modal.scss +0 -24
- package/navigation/Menu.vue +0 -16
- package/navigation/MenuItem.vue +0 -20
- package/navigation/MenuItemGroup.vue +0 -20
- package/navigation/SubMenu.vue +0 -20
- /package/{form → _Build/vue/components/form}/Checkbox.vue +0 -0
- /package/{form → _Build/vue/components/form}/color.vue +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
axios.interceptors.request.use(
|
|
4
|
+
(request) => {
|
|
5
|
+
throw { isLocal: true, data: retrieveResponse(request) };
|
|
6
|
+
},
|
|
7
|
+
(error) => {
|
|
8
|
+
return Promise.resolve(error);
|
|
9
|
+
},
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
axios.interceptors.response.use(
|
|
13
|
+
(response) => {
|
|
14
|
+
return response;
|
|
15
|
+
},
|
|
16
|
+
(error) => {
|
|
17
|
+
return Promise.resolve(error);
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
function retrieveResponse(request) {
|
|
22
|
+
return fakes[request.url][request.method];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const fakes = {
|
|
26
|
+
"/api/users/self": {
|
|
27
|
+
get: {
|
|
28
|
+
data: {
|
|
29
|
+
id: 2,
|
|
30
|
+
company_id: 1,
|
|
31
|
+
created_at: "2025-04-14T15:11:11.000000Z",
|
|
32
|
+
updated_at: "2025-04-16T16:45:55.000000Z",
|
|
33
|
+
newsletter: null,
|
|
34
|
+
admin: 1,
|
|
35
|
+
name: "Jeremy Viner",
|
|
36
|
+
email: "jeremy.viner@avalerehealth.com",
|
|
37
|
+
email_verified_at: "2025-04-16T16:45:55.000000Z",
|
|
38
|
+
brands: [],
|
|
39
|
+
company: {
|
|
40
|
+
id: 1,
|
|
41
|
+
name: "Company 0",
|
|
42
|
+
created_at: "2025-04-14T15:08:50.000000Z",
|
|
43
|
+
updated_at: "2025-04-14T15:08:50.000000Z",
|
|
44
|
+
domains: [
|
|
45
|
+
"okuneva.com",
|
|
46
|
+
"bogisich.info",
|
|
47
|
+
"avalerehealth.com",
|
|
48
|
+
],
|
|
49
|
+
brands: [1],
|
|
50
|
+
events: [],
|
|
51
|
+
therapy_areas: [],
|
|
52
|
+
event_therapy_areas: [],
|
|
53
|
+
event_therapy_area_media_types: [],
|
|
54
|
+
users_count: null,
|
|
55
|
+
sso_client_id: "5ea409fc-8dcf-423e-b7fa-867422859ea4",
|
|
56
|
+
sso_client_secret:
|
|
57
|
+
"aSS8Q~ss0r-uh.fPLHUXVXp2kIs5IfwTjzomrb_I",
|
|
58
|
+
sso_tenant: "4a33c544-865e-44a4-836f-bc51800f6c5e",
|
|
59
|
+
sso_type: "azure",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
"/user/password": {
|
|
65
|
+
put: {},
|
|
66
|
+
},
|
|
67
|
+
"/logged-in": {
|
|
68
|
+
get: { "logged-in": true },
|
|
69
|
+
},
|
|
70
|
+
"/logout": {
|
|
71
|
+
post: {},
|
|
72
|
+
},
|
|
73
|
+
"/login": {
|
|
74
|
+
post: {
|
|
75
|
+
two_factor: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
function setAxiosDefaults(baseUrl, router) {
|
|
4
|
+
axios.defaults.baseURL = baseUrl;
|
|
5
|
+
axios.defaults.withCredentials = true;
|
|
6
|
+
axios.defaults.withXSRFToken = true;
|
|
7
|
+
|
|
8
|
+
// Some libraries will utilize the globally available version of axios so make sure it's our exact axios instance
|
|
9
|
+
window.axios = axios;
|
|
10
|
+
|
|
11
|
+
// Redirect to login page if 401
|
|
12
|
+
axios.interceptors.response.use(null, (error) => {
|
|
13
|
+
if (error.response) {
|
|
14
|
+
if (
|
|
15
|
+
error.response.status === 401 &&
|
|
16
|
+
router.currentRoute.value.name !== "auth.logout"
|
|
17
|
+
) {
|
|
18
|
+
router.push({
|
|
19
|
+
name: "auth.logout",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (error.response.status === 404) {
|
|
24
|
+
router.push({ name: "index" });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return Promise.reject(error);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Pull all paginated data
|
|
32
|
+
window.axios.getAll = (url, options = {}) => {
|
|
33
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
34
|
+
return new Promise(async (resolve, reject) => {
|
|
35
|
+
try {
|
|
36
|
+
const arr = { data: { data: [] } };
|
|
37
|
+
let page = 0;
|
|
38
|
+
|
|
39
|
+
while (true) {
|
|
40
|
+
const res = await window.axios.get(
|
|
41
|
+
`${url}${url.includes("?") ? "&" : "?"}page=${++page}`,
|
|
42
|
+
options,
|
|
43
|
+
);
|
|
44
|
+
arr.data.data = arr.data.data.concat(res.data.data);
|
|
45
|
+
if (
|
|
46
|
+
res.data.next_page_url === null ||
|
|
47
|
+
(res.data.links && res.data.links.next === null)
|
|
48
|
+
)
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
resolve(arr);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
setAxiosDefaults,
|
|
62
|
+
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { h } from "vue";
|
|
4
|
+
import { RouterView } from "vue-router";
|
|
5
|
+
|
|
6
|
+
// Admin routes export - minimal auth flow (headless login only)
|
|
7
|
+
export function adminRoutes(node) {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
path: "/auth",
|
|
11
|
+
name: "auth",
|
|
12
|
+
component: { render: () => h(RouterView) },
|
|
13
|
+
redirect: () => ({ name: "auth.login" }),
|
|
14
|
+
props: true,
|
|
15
|
+
meta: {
|
|
16
|
+
guest: true,
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
{
|
|
20
|
+
path: "login",
|
|
21
|
+
component: node
|
|
22
|
+
? ""
|
|
23
|
+
: require("../routes/loginheadless.vue").default,
|
|
24
|
+
name: "auth.login",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
path: "logout",
|
|
28
|
+
component: node
|
|
29
|
+
? ""
|
|
30
|
+
: require("../routes/logoutheadless.vue").default,
|
|
31
|
+
name: "auth.logout",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: "callback",
|
|
35
|
+
component: node
|
|
36
|
+
? ""
|
|
37
|
+
: require("../routes/logincallback.vue").default,
|
|
38
|
+
name: "auth.callback",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
path: "/users",
|
|
44
|
+
component: node
|
|
45
|
+
? ""
|
|
46
|
+
: require("../adminRoutes/PUsers/parent.vue").default,
|
|
47
|
+
children: [
|
|
48
|
+
{
|
|
49
|
+
path: "",
|
|
50
|
+
component: node
|
|
51
|
+
? ""
|
|
52
|
+
: require("../adminRoutes/PUsers/Children/index.vue")
|
|
53
|
+
.default,
|
|
54
|
+
name: "users.index",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
path: "create",
|
|
58
|
+
component: node
|
|
59
|
+
? ""
|
|
60
|
+
: require("../adminRoutes/PUsers/Children/create.vue")
|
|
61
|
+
.default,
|
|
62
|
+
name: "users.create",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
path: ":id",
|
|
66
|
+
component: node
|
|
67
|
+
? ""
|
|
68
|
+
: require("../adminRoutes/PUsers/Children/show.vue")
|
|
69
|
+
.default,
|
|
70
|
+
name: "users.show",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
path: ":id/edit",
|
|
74
|
+
component: node
|
|
75
|
+
? ""
|
|
76
|
+
: require("../adminRoutes/PUsers/Children/edit.vue")
|
|
77
|
+
.default,
|
|
78
|
+
name: "users.edit",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
path: "/companies",
|
|
84
|
+
component: node
|
|
85
|
+
? ""
|
|
86
|
+
: require("../adminRoutes/PCompanies/parent.vue").default,
|
|
87
|
+
children: [
|
|
88
|
+
{
|
|
89
|
+
path: "",
|
|
90
|
+
component: node
|
|
91
|
+
? ""
|
|
92
|
+
: require("../adminRoutes/PCompanies/Children/index.vue")
|
|
93
|
+
.default,
|
|
94
|
+
name: "companies.index",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
path: "create",
|
|
98
|
+
component: node
|
|
99
|
+
? ""
|
|
100
|
+
: require("../adminRoutes/PCompanies/Children/create.vue")
|
|
101
|
+
.default,
|
|
102
|
+
name: "companies.create",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
path: ":id",
|
|
106
|
+
component: node
|
|
107
|
+
? ""
|
|
108
|
+
: require("../adminRoutes/PCompanies/Children/show.vue")
|
|
109
|
+
.default,
|
|
110
|
+
name: "companies.show",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
path: ":id/edit",
|
|
114
|
+
component: node
|
|
115
|
+
? ""
|
|
116
|
+
: require("../adminRoutes/PCompanies/Children/edit.vue")
|
|
117
|
+
.default,
|
|
118
|
+
name: "companies.edit",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
path: ":id/upload",
|
|
122
|
+
component: node
|
|
123
|
+
? ""
|
|
124
|
+
: require("../adminRoutes/PCompanies/Children/Upload/upload.vue")
|
|
125
|
+
.default,
|
|
126
|
+
name: "companies.upload",
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Standard routes export - full auth flow
|
|
134
|
+
export function routes(node) {
|
|
135
|
+
return [
|
|
136
|
+
{
|
|
137
|
+
path: "/auth",
|
|
138
|
+
name: "auth",
|
|
139
|
+
component: require("../routes/container.vue").default,
|
|
140
|
+
redirect: () => ({ name: "auth.login" }),
|
|
141
|
+
props: true,
|
|
142
|
+
meta: {
|
|
143
|
+
guest: true,
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
{
|
|
147
|
+
path: "login-creds",
|
|
148
|
+
component: node
|
|
149
|
+
? ""
|
|
150
|
+
: require("../routes/login.vue").default,
|
|
151
|
+
name: "auth.logincreds",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
path: "login",
|
|
155
|
+
component: node
|
|
156
|
+
? ""
|
|
157
|
+
: require("../routes/loginsso.vue").default,
|
|
158
|
+
name: "auth.login",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
path: "callback",
|
|
162
|
+
component: node
|
|
163
|
+
? ""
|
|
164
|
+
: require("../routes/logincallback.vue").default,
|
|
165
|
+
name: "auth.callback",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
path: "forgot",
|
|
169
|
+
component: require("../routes/forgot.vue").default,
|
|
170
|
+
name: "auth.forgot",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
path: "reset",
|
|
174
|
+
component: require("../routes/reset.vue").default,
|
|
175
|
+
name: "auth.reset",
|
|
176
|
+
props: true,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
path: "force-reset",
|
|
180
|
+
component: require("../routes/force-reset.vue").default,
|
|
181
|
+
name: "auth.force-reset",
|
|
182
|
+
props: true,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
path: "register",
|
|
186
|
+
component: require("../routes/register.vue").default,
|
|
187
|
+
name: "auth.register",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
path: "verify",
|
|
191
|
+
component: require("../routes/verify.vue").default,
|
|
192
|
+
name: "auth.verify",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
path: "verified",
|
|
196
|
+
component: require("../routes/success-verify.vue").default,
|
|
197
|
+
name: "auth.success-verify",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
path: "expired-verification",
|
|
201
|
+
component: require("../routes/expired-verification.vue")
|
|
202
|
+
.default,
|
|
203
|
+
name: "auth.expired-verification",
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
path: "expired-reset",
|
|
207
|
+
component: require("../routes/expired-reset.vue").default,
|
|
208
|
+
name: "auth.expired-reset",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
path: "success-reset",
|
|
212
|
+
component: require("../routes/success-reset.vue").default,
|
|
213
|
+
name: "auth.success-reset",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
path: "success-forgot",
|
|
217
|
+
component: require("../routes/success-forgot.vue").default,
|
|
218
|
+
name: "auth.success-forgot",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
path: "account-exists",
|
|
222
|
+
component: require("../routes/account-exists.vue").default,
|
|
223
|
+
name: "auth.account-exists",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
path: "logout",
|
|
227
|
+
component: require("../routes/logout.vue").default,
|
|
228
|
+
name: "auth.logout",
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
path: "/admin",
|
|
234
|
+
component: require("../routes/loginheadless.vue").default,
|
|
235
|
+
name: "admin",
|
|
236
|
+
meta: {
|
|
237
|
+
guest: true,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function beforeEach(router, store) {
|
|
244
|
+
router.beforeEach(async (to, from, next) => {
|
|
245
|
+
// If authenticated query param is present, assume authentication has happened elsewhere and attempt to fetch user data
|
|
246
|
+
if (to.query.authenticated && !store.getters.authenticated) {
|
|
247
|
+
await store.dispatch("getUser", {
|
|
248
|
+
errors: (e) => console.error(e),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const { user, redirect } = store.state.auth;
|
|
253
|
+
|
|
254
|
+
// User verification handling and redirect if user alrady verified but accessing an expired verification route
|
|
255
|
+
if (
|
|
256
|
+
to.query.verified ||
|
|
257
|
+
(to.name === "auth.expired-verification" && user?.email_verified_at)
|
|
258
|
+
) {
|
|
259
|
+
next({ name: "auth.success-verify" });
|
|
260
|
+
} else if (store.getters.authenticated) {
|
|
261
|
+
// User is authenticated - check permissions and redirect appropriately
|
|
262
|
+
if (user.force_password_change && to.name !== "auth.force-reset") {
|
|
263
|
+
// User needs to change password - redirect to force reset
|
|
264
|
+
next({ name: "auth.force-reset" });
|
|
265
|
+
} else if (to.name === "auth.login") {
|
|
266
|
+
// Already logged in user hitting login
|
|
267
|
+
next({ name: redirect });
|
|
268
|
+
} else if (
|
|
269
|
+
!user?.email_verified_at &&
|
|
270
|
+
to.matched.some((d) => d.meta.guest) !== true
|
|
271
|
+
) {
|
|
272
|
+
// User needs email verification and trying to access protected route
|
|
273
|
+
next({ name: "auth.verify" });
|
|
274
|
+
} else {
|
|
275
|
+
// User is authenticated and authorized - proceed
|
|
276
|
+
next();
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
// User is not authenticated - handle guest routes and login redirects
|
|
280
|
+
if (to.matched.some((d) => d.meta.guest) === true) {
|
|
281
|
+
// Route allows guest access - proceed
|
|
282
|
+
next();
|
|
283
|
+
} else {
|
|
284
|
+
// Protected route requires authentication - redirect to standard login
|
|
285
|
+
next({ name: "auth.login" });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export default {
|
|
292
|
+
routes,
|
|
293
|
+
adminRoutes,
|
|
294
|
+
beforeEach,
|
|
295
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
|
|
4
|
+
const store = {
|
|
5
|
+
state() {
|
|
6
|
+
return {
|
|
7
|
+
intended: null,
|
|
8
|
+
user: null,
|
|
9
|
+
redirect: process.env.HYDRATE_REDIRECT ?? "index",
|
|
10
|
+
contact:
|
|
11
|
+
process.env.HYDRATE_CONTACT ?? "mailto:det@avalerehealth.com",
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
getters: {
|
|
16
|
+
authenticated: (state) => !!state.user,
|
|
17
|
+
can: (state) => (permission) => {
|
|
18
|
+
return state.user?.permissions
|
|
19
|
+
.map(({ name }) => name)
|
|
20
|
+
.includes(permission);
|
|
21
|
+
},
|
|
22
|
+
hasRole: (state) => (role) => {
|
|
23
|
+
return state.user?.roles.map(({ name }) => name).includes(role);
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
mutations: {
|
|
28
|
+
setUser(state, value) {
|
|
29
|
+
state.user = value;
|
|
30
|
+
|
|
31
|
+
if (window.dataLayer) {
|
|
32
|
+
window.dataLayer.push({ event: "logic", user: value });
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setIntended(state, value) {
|
|
36
|
+
state.intended = value;
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
actions: {
|
|
41
|
+
getUser({ commit }, { errors, query = "", params }) {
|
|
42
|
+
return axios
|
|
43
|
+
.get(`/api/users/self${query}`, {
|
|
44
|
+
params,
|
|
45
|
+
})
|
|
46
|
+
.then((res) => {
|
|
47
|
+
commit("setUser", res.data.data);
|
|
48
|
+
|
|
49
|
+
return res.data.data;
|
|
50
|
+
})
|
|
51
|
+
.catch(errors);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
logout({ commit }, { errors }) {
|
|
55
|
+
commit("setUser", null);
|
|
56
|
+
|
|
57
|
+
return axios.post("/logout");
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default store;
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
<div class="relative">
|
|
3
3
|
<section id="resetPasswordForm">
|
|
4
4
|
<h1 class="h2">Account already exists</h1>
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
<p class="mt AM-mb-0 color-21">
|
|
7
7
|
<strong class="">Company: {{ $route.query.company }}</strong>
|
|
8
8
|
</p>
|
|
9
|
-
<p class="AM-mt-0.5">
|
|
10
|
-
Your company already has an active account.
|
|
11
|
-
</p>
|
|
9
|
+
<p class="AM-mt-0.5">Your company already has an active account.</p>
|
|
12
10
|
|
|
13
11
|
<elButton
|
|
14
12
|
tag="router-link"
|
|
15
|
-
:to="{name:
|
|
13
|
+
:to="{ name: 'auth.login' }"
|
|
16
14
|
type="primary"
|
|
17
15
|
>
|
|
18
16
|
<span v-text="'Sign in'" />
|
|
@@ -29,7 +27,7 @@ export default {
|
|
|
29
27
|
};
|
|
30
28
|
},
|
|
31
29
|
components: {
|
|
32
|
-
elButton: require(
|
|
33
|
-
}
|
|
30
|
+
elButton: require("../../basic/Button.vue").default,
|
|
31
|
+
},
|
|
34
32
|
};
|
|
35
33
|
</script>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="relative">
|
|
3
3
|
<section id="resetPasswordForm">
|
|
4
|
-
<h1
|
|
4
|
+
<h1
|
|
5
|
+
class="h2 h2--small"
|
|
6
|
+
v-html="!form.successful ? 'Change password' : 'Success'"
|
|
7
|
+
/>
|
|
5
8
|
<form class="form" @submit.prevent="submit">
|
|
6
9
|
<div v-if="!form.successful">
|
|
7
10
|
<p class="AM-mt-2 AM-mb-0">
|
|
8
|
-
Please complete the fields below to change your
|
|
11
|
+
Please complete the fields below to change your
|
|
12
|
+
password.
|
|
9
13
|
</p>
|
|
10
14
|
|
|
11
15
|
<el-input
|
|
@@ -32,9 +36,13 @@
|
|
|
32
36
|
:password="true"
|
|
33
37
|
/>
|
|
34
38
|
|
|
35
|
-
<VPasswordValidation
|
|
39
|
+
<VPasswordValidation
|
|
40
|
+
:password="form.password"
|
|
41
|
+
@passwordValid="updatePasswordValidity"
|
|
42
|
+
/>
|
|
36
43
|
<div class="flex AM-mt-3">
|
|
37
44
|
<elButton
|
|
45
|
+
native-type="submit"
|
|
38
46
|
class=""
|
|
39
47
|
type="primary"
|
|
40
48
|
:disabled="form.processing || !isPasswordValid"
|
|
@@ -54,13 +62,11 @@
|
|
|
54
62
|
</div>
|
|
55
63
|
</div>
|
|
56
64
|
<div v-else>
|
|
57
|
-
<strong class=""
|
|
58
|
-
|
|
59
|
-
<elButton
|
|
60
|
-
class=""
|
|
61
|
-
type="secondary"
|
|
62
|
-
@click="handleButton"
|
|
65
|
+
<strong class=""
|
|
66
|
+
>Email: {{ $store.state.auth?.user?.email }}</strong
|
|
63
67
|
>
|
|
68
|
+
<p v-text="`Your password has been updated.`" />
|
|
69
|
+
<elButton class="" type="secondary" @click="handleButton">
|
|
64
70
|
<span v-text="'Continue'" />
|
|
65
71
|
</elButton>
|
|
66
72
|
</div>
|
|
@@ -78,17 +84,16 @@ export default {
|
|
|
78
84
|
form: new Form(
|
|
79
85
|
{
|
|
80
86
|
email: this.$store.state.auth.user?.email,
|
|
81
|
-
password:
|
|
82
|
-
current_password:
|
|
87
|
+
password: "",
|
|
88
|
+
current_password: "",
|
|
83
89
|
},
|
|
84
|
-
{ resetOnSuccess: false }
|
|
90
|
+
{ resetOnSuccess: false },
|
|
85
91
|
),
|
|
86
92
|
isPasswordValid: false,
|
|
87
93
|
};
|
|
88
94
|
},
|
|
89
95
|
|
|
90
96
|
mounted() {
|
|
91
|
-
|
|
92
97
|
this.$store.dispatch("getUser", {
|
|
93
98
|
errors: this.$root.errors,
|
|
94
99
|
});
|
|
@@ -99,7 +104,7 @@ export default {
|
|
|
99
104
|
this.loading = true;
|
|
100
105
|
|
|
101
106
|
try {
|
|
102
|
-
await this.form.put(
|
|
107
|
+
await this.form.put("/user/password");
|
|
103
108
|
await this.login();
|
|
104
109
|
} catch (e) {
|
|
105
110
|
this.$root.errors(e);
|
|
@@ -113,16 +118,15 @@ export default {
|
|
|
113
118
|
try {
|
|
114
119
|
const res = await this.form.post("/login");
|
|
115
120
|
|
|
116
|
-
if(res[
|
|
117
|
-
try{
|
|
121
|
+
if (res["logged-in"]) {
|
|
122
|
+
try {
|
|
118
123
|
await this.$store.dispatch("logout", {
|
|
119
124
|
// errors: this.$root.errors,
|
|
120
125
|
});
|
|
121
|
-
} catch(e){}
|
|
126
|
+
} catch (e) {}
|
|
122
127
|
|
|
123
128
|
await this.form.post("/login");
|
|
124
129
|
}
|
|
125
|
-
|
|
126
130
|
} catch (e) {
|
|
127
131
|
this.$root.errors(e);
|
|
128
132
|
} finally {
|
|
@@ -135,12 +139,10 @@ export default {
|
|
|
135
139
|
this.isPasswordValid = isValid;
|
|
136
140
|
},
|
|
137
141
|
handleButton() {
|
|
138
|
-
this.$emit(
|
|
142
|
+
this.$emit("close");
|
|
139
143
|
},
|
|
140
|
-
|
|
141
|
-
async postLogin() {
|
|
142
|
-
this.$store.commit("setAuth", true);
|
|
143
144
|
|
|
145
|
+
async postLogin() {
|
|
144
146
|
const { data: user } = await this.$store.dispatch("getUser", {
|
|
145
147
|
errors: this.$root.errors,
|
|
146
148
|
});
|
|
@@ -154,9 +156,10 @@ export default {
|
|
|
154
156
|
},
|
|
155
157
|
|
|
156
158
|
components: {
|
|
157
|
-
VPasswordValidation: require("./../components/VPasswordValidation.vue")
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
VPasswordValidation: require("./../components/VPasswordValidation.vue")
|
|
160
|
+
.default,
|
|
161
|
+
elInput: require("../../form/basic.vue").default,
|
|
162
|
+
elButton: require("../../basic/Button.vue").default,
|
|
160
163
|
},
|
|
161
164
|
};
|
|
162
165
|
</script>
|
|
@@ -22,17 +22,13 @@
|
|
|
22
22
|
|
|
23
23
|
<script>
|
|
24
24
|
export default {
|
|
25
|
-
mounted() {
|
|
26
|
-
|
|
27
|
-
},
|
|
25
|
+
mounted() {},
|
|
28
26
|
data() {
|
|
29
27
|
return {
|
|
30
|
-
|
|
31
|
-
}
|
|
28
|
+
logoName: process.env.HYDRATE_LOGO,
|
|
29
|
+
};
|
|
32
30
|
},
|
|
33
31
|
|
|
34
|
-
components: {
|
|
35
|
-
|
|
36
|
-
},
|
|
32
|
+
components: {},
|
|
37
33
|
};
|
|
38
34
|
</script>
|