@fishawack/lab-velocity 2.0.0-beta.1 → 2.0.0-beta.3
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/_Build/vue/components/Icon.vue +33 -0
- package/_Build/vue/components/Svg.vue +45 -0
- package/_Build/vue/components/basic/Button.vue +109 -0
- package/_Build/vue/components/basic/link.vue +64 -0
- package/_Build/vue/components/form/Cascader.vue +85 -0
- package/_Build/vue/components/form/Checkbox.vue +39 -0
- package/_Build/vue/components/form/CheckboxGroup.vue +91 -0
- package/_Build/vue/components/form/DatePicker.vue +116 -0
- package/_Build/vue/components/form/InputNumber.vue +89 -0
- package/_Build/vue/components/form/Select.vue +109 -0
- package/_Build/vue/components/form/Switch.vue +63 -0
- package/_Build/vue/components/form/Upload.vue +101 -0
- package/_Build/vue/components/form/Wysiwyg.vue +127 -0
- package/_Build/vue/components/form/Wysiwyg2.vue +577 -0
- package/_Build/vue/components/form/basic.vue +106 -0
- package/_Build/vue/components/form/color.vue +22 -0
- package/_Build/vue/components/form/file.vue +89 -0
- package/_Build/vue/components/form/input.js +79 -0
- package/_Build/vue/components/form/input.vue +105 -0
- package/_Build/vue/components/layout/Alert.vue +38 -0
- package/_Build/vue/components/layout/Footer.vue +50 -0
- package/_Build/vue/components/layout/Header.vue +13 -0
- package/_Build/vue/components/layout/Loader.vue +59 -0
- package/_Build/vue/components/layout/Tooltip.vue +46 -0
- package/_Build/vue/components/layout/pageTitle.vue +18 -0
- package/_Build/vue/components/layout/sideBar.vue +25 -0
- package/_Build/vue/components/navigation/Breadcrumbs.vue +37 -0
- package/_Build/vue/components/navigation/BreadcrumbsItem.vue +19 -0
- 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/_Build/vue/modules/AuthModule/components/AuthModal.vue +105 -0
- 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 +33 -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/_Build/vue/modules/AuthModule/routes/account-exists.vue +33 -0
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +165 -0
- package/_Build/vue/modules/AuthModule/routes/container.vue +34 -0
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +78 -0
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +100 -0
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +152 -0
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +91 -0
- package/_Build/vue/modules/AuthModule/routes/login.vue +143 -0
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +41 -0
- package/_Build/vue/modules/AuthModule/routes/loginheadless.vue +21 -0
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +134 -0
- package/_Build/vue/modules/AuthModule/routes/logout.vue +21 -0
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +27 -0
- package/_Build/vue/modules/AuthModule/routes/register.vue +174 -0
- package/_Build/vue/modules/AuthModule/routes/reset.vue +133 -0
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +119 -0
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +35 -0
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +32 -0
- package/_Build/vue/modules/AuthModule/routes/verify.vue +113 -0
- package/package.json +3 -9
- package/components/_alert.scss +0 -5
- package/components/_basic.scss +0 -55
- package/components/_breadcrumbs.scss +0 -39
- package/components/_button.scss +0 -304
- package/components/_cascader.scss +0 -12
- package/components/_checkbox.scss +0 -41
- package/components/_chip.scss +0 -24
- package/components/_collapse.scss +0 -24
- package/components/_datepicker.scss +0 -52
- package/components/_footer.scss +0 -46
- package/components/_form.scss +0 -24
- package/components/_header.scss +0 -54
- package/components/_icon.scss +0 -25
- package/components/_input.scss +0 -0
- package/components/_inputNumber.scss +0 -22
- package/components/_link.scss +0 -44
- package/components/_loader.scss +0 -43
- package/components/_menu.scss +0 -112
- package/components/_pageTitle.scss +0 -8
- package/components/_permissionLegend.scss +0 -18
- package/components/_select.scss +0 -29
- package/components/_sidebar.scss +0 -56
- package/components/_switch.scss +0 -14
- package/components/_table.scss +0 -20
- package/components/_tooltip.scss +0 -4
- package/components/_typography.scss +0 -162
- package/components/_upload.scss +0 -15
- package/components/_wysiwyg.scss +0 -7
- package/components/_wysiwyg2.scss +0 -142
- package/modules/_AuthModule.scss +0 -212
- package/modules/_AuthVariables.scss +0 -7
- package/modules/_modal.scss +0 -24
|
@@ -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;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<section id="resetPasswordForm">
|
|
4
|
+
<h1 class="h2">Account already exists</h1>
|
|
5
|
+
|
|
6
|
+
<p class="mt AM-mb-0 color-21">
|
|
7
|
+
<strong class="">Company: {{ $route.query.company }}</strong>
|
|
8
|
+
</p>
|
|
9
|
+
<p class="AM-mt-0.5">Your company already has an active account.</p>
|
|
10
|
+
|
|
11
|
+
<elButton
|
|
12
|
+
tag="router-link"
|
|
13
|
+
:to="{ name: 'auth.login' }"
|
|
14
|
+
type="primary"
|
|
15
|
+
>
|
|
16
|
+
<span v-text="'Sign in'" />
|
|
17
|
+
</elButton>
|
|
18
|
+
</section>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
metaInfo() {
|
|
25
|
+
return {
|
|
26
|
+
title: "Account Exists | Error",
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
components: {
|
|
30
|
+
elButton: require("../../../components/basic/Button.vue").default,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<section id="resetPasswordForm">
|
|
4
|
+
<h1
|
|
5
|
+
class="h2 h2--small"
|
|
6
|
+
v-html="!form.successful ? 'Change password' : 'Success'"
|
|
7
|
+
/>
|
|
8
|
+
<form class="form" @submit.prevent="submit">
|
|
9
|
+
<div v-if="!form.successful">
|
|
10
|
+
<p class="AM-mt-2 AM-mb-0">
|
|
11
|
+
Please complete the fields below to change your
|
|
12
|
+
password.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<el-input
|
|
16
|
+
class="AM-mt-3"
|
|
17
|
+
label="Current password"
|
|
18
|
+
placeholder="Enter your current password"
|
|
19
|
+
name="current_password"
|
|
20
|
+
type="password"
|
|
21
|
+
required
|
|
22
|
+
v-model="form.current_password"
|
|
23
|
+
:error="form.errors"
|
|
24
|
+
:password="true"
|
|
25
|
+
/>
|
|
26
|
+
<el-input
|
|
27
|
+
v-model="form.password"
|
|
28
|
+
class="AM-mt-2 AM-mb-2"
|
|
29
|
+
label="New Password"
|
|
30
|
+
placeholder="Enter your new password"
|
|
31
|
+
name="password"
|
|
32
|
+
:error="form.errors"
|
|
33
|
+
type="password"
|
|
34
|
+
autocomplete="new-password"
|
|
35
|
+
required
|
|
36
|
+
:password="true"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<VPasswordValidation
|
|
40
|
+
:password="form.password"
|
|
41
|
+
@passwordValid="updatePasswordValidity"
|
|
42
|
+
/>
|
|
43
|
+
<div class="flex AM-mt-3">
|
|
44
|
+
<elButton
|
|
45
|
+
native-type="submit"
|
|
46
|
+
class=""
|
|
47
|
+
type="primary"
|
|
48
|
+
:disabled="form.processing || !isPasswordValid"
|
|
49
|
+
:loading="form.processing"
|
|
50
|
+
@click="onSubmit"
|
|
51
|
+
>
|
|
52
|
+
<span v-text="'Change password'" />
|
|
53
|
+
</elButton>
|
|
54
|
+
|
|
55
|
+
<elButton
|
|
56
|
+
class=""
|
|
57
|
+
type="secondary"
|
|
58
|
+
@click="handleButton"
|
|
59
|
+
>
|
|
60
|
+
<span v-text="'Cancel'" />
|
|
61
|
+
</elButton>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div v-else>
|
|
65
|
+
<strong class=""
|
|
66
|
+
>Email: {{ $store.state.auth?.user?.email }}</strong
|
|
67
|
+
>
|
|
68
|
+
<p v-text="`Your password has been updated.`" />
|
|
69
|
+
<elButton class="" type="secondary" @click="handleButton">
|
|
70
|
+
<span v-text="'Continue'" />
|
|
71
|
+
</elButton>
|
|
72
|
+
</div>
|
|
73
|
+
</form>
|
|
74
|
+
</section>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script>
|
|
79
|
+
import Form from "form-backend-validation";
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
data() {
|
|
83
|
+
return {
|
|
84
|
+
form: new Form(
|
|
85
|
+
{
|
|
86
|
+
email: this.$store.state.auth.user?.email,
|
|
87
|
+
password: "",
|
|
88
|
+
current_password: "",
|
|
89
|
+
},
|
|
90
|
+
{ resetOnSuccess: false },
|
|
91
|
+
),
|
|
92
|
+
isPasswordValid: false,
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
mounted() {
|
|
97
|
+
this.$store.dispatch("getUser", {
|
|
98
|
+
errors: this.$root.errors,
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
methods: {
|
|
103
|
+
async onSubmit() {
|
|
104
|
+
this.loading = true;
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
await this.form.put("/user/password");
|
|
108
|
+
await this.login();
|
|
109
|
+
} catch (e) {
|
|
110
|
+
this.$root.errors(e);
|
|
111
|
+
} finally {
|
|
112
|
+
this.loading = false;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
async login() {
|
|
116
|
+
this.loading = true;
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
const res = await this.form.post("/login");
|
|
120
|
+
|
|
121
|
+
if (res["logged-in"]) {
|
|
122
|
+
try {
|
|
123
|
+
await this.$store.dispatch("logout", {
|
|
124
|
+
// errors: this.$root.errors,
|
|
125
|
+
});
|
|
126
|
+
} catch (e) {}
|
|
127
|
+
|
|
128
|
+
await this.form.post("/login");
|
|
129
|
+
}
|
|
130
|
+
} catch (e) {
|
|
131
|
+
this.$root.errors(e);
|
|
132
|
+
} finally {
|
|
133
|
+
this.loading = false;
|
|
134
|
+
this.postLogin();
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
updatePasswordValidity(isValid) {
|
|
139
|
+
this.isPasswordValid = isValid;
|
|
140
|
+
},
|
|
141
|
+
handleButton() {
|
|
142
|
+
this.$emit("close");
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
async postLogin() {
|
|
146
|
+
const { data: user } = await this.$store.dispatch("getUser", {
|
|
147
|
+
errors: this.$root.errors,
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
metaInfo() {
|
|
153
|
+
return {
|
|
154
|
+
title: "Reset Password",
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
components: {
|
|
159
|
+
VPasswordValidation: require("./../components/VPasswordValidation.vue")
|
|
160
|
+
.default,
|
|
161
|
+
elInput: require("../../../components/form/basic.vue").default,
|
|
162
|
+
elButton: require("../../../components/basic/Button.vue").default,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="AuthModule">
|
|
3
|
+
<section class="AuthModule__Content">
|
|
4
|
+
<div class="AuthModule__logo__container">
|
|
5
|
+
<router-link to="/" class="logo" aria-label="Go to home page">
|
|
6
|
+
<GSvg
|
|
7
|
+
class="AuthModule__logo"
|
|
8
|
+
:name="logoName"
|
|
9
|
+
embed
|
|
10
|
+
asis
|
|
11
|
+
role="presentation"
|
|
12
|
+
tabindex="-1"
|
|
13
|
+
/>
|
|
14
|
+
</router-link>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="AuthModule__form">
|
|
17
|
+
<router-view />
|
|
18
|
+
</div>
|
|
19
|
+
</section>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
mounted() {},
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
logoName: process.env.HYDRATE_LOGO,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
components: {},
|
|
33
|
+
};
|
|
34
|
+
</script>
|