@fishawack/lab-velocity 2.0.0-beta.6 → 2.0.0-beta.61
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 +467 -36
- package/_Build/js/libs/build-id.js +14 -0
- package/_Build/js/libs/filters.js +36 -0
- package/_Build/js/libs/globals.js +7 -0
- package/_Build/js/libs/router.js +22 -0
- package/_Build/js/libs/routes.js +29 -0
- package/_Build/js/libs/store.js +21 -0
- package/_Build/js/libs/utility.js +161 -0
- package/_Build/vue/components/basic/Button.vue +1 -1
- package/_Build/vue/components/form/Avatar.vue +90 -0
- package/_Build/vue/components/form/Checkbox.vue +10 -0
- package/_Build/vue/components/form/InputNumber.vue +1 -1
- package/_Build/vue/components/form/Select.vue +221 -31
- package/_Build/vue/components/form/Wysiwyg2.vue +87 -2
- package/_Build/vue/components/form/wysiwyg2-video.js +41 -0
- package/_Build/vue/components/layout/Alert.vue +5 -5
- package/_Build/vue/components/layout/Audit.vue +159 -0
- package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +4 -4
- package/_Build/vue/{modules/AuthModule/components → components/layout}/Chips.vue +2 -2
- package/_Build/vue/components/layout/Footer.vue +11 -10
- package/_Build/vue/{modules/AuthModule/components/VFormFooter.vue → components/layout/FormFooter.vue} +2 -2
- package/_Build/vue/{modules/AuthModule/components → components/layout}/FormRole.vue +8 -8
- package/_Build/vue/components/layout/Layout.vue +94 -0
- package/_Build/vue/components/layout/Navigation.vue +83 -0
- package/_Build/vue/{modules/AuthModule/components/VPageHeader.vue → components/layout/PageHeader.vue} +14 -8
- package/_Build/vue/components/layout/SideBar.vue +26 -0
- package/_Build/vue/{modules/AuthModule/components/VTable.vue → components/layout/Table.vue} +24 -12
- package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +92 -48
- package/_Build/vue/components/layout/TokenDisplay.vue +52 -0
- package/_Build/vue/components/layout/pageTitle.vue +1 -1
- package/_Build/vue/components/navigation/Menu.vue +6 -1
- package/_Build/vue/components/navigation/MenuItem.vue +7 -2
- package/_Build/vue/components/navigation/MenuItemGroup.vue +7 -2
- package/_Build/vue/modules/AuthModule/js/axios.js +21 -1
- package/_Build/vue/modules/AuthModule/js/clear-cookies.js +34 -0
- package/_Build/vue/modules/AuthModule/js/guest-request.js +32 -0
- package/_Build/vue/modules/AuthModule/js/impersonation-banner.js +102 -0
- package/_Build/vue/modules/AuthModule/js/router.js +91 -114
- package/_Build/vue/modules/AuthModule/js/store.js +23 -6
- package/_Build/vue/modules/AuthModule/routes/PCompanies/columns.js +268 -0
- package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +213 -0
- package/_Build/vue/modules/AuthModule/routes/PIntegrations/columns.js +58 -0
- package/_Build/vue/modules/AuthModule/routes/PIntegrations/resource.js +79 -0
- package/_Build/vue/modules/AuthModule/routes/PTeams/columns.js +78 -0
- package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +251 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/SetPasswordAction.vue +51 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/SetPasswordDialog.vue +138 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/columns.js +349 -0
- package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +239 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +28 -32
- package/_Build/vue/modules/AuthModule/routes/container.vue +2 -11
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +4 -4
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +10 -9
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +44 -58
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +10 -5
- package/_Build/vue/modules/AuthModule/routes/login.vue +12 -19
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +14 -10
- package/_Build/vue/modules/AuthModule/routes/logout.vue +14 -5
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +16 -5
- package/_Build/vue/modules/AuthModule/routes/register.vue +24 -28
- package/_Build/vue/modules/AuthModule/routes/reset.vue +20 -14
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +14 -8
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/verify.vue +11 -14
- package/_Build/vue/modules/resource/Children/create.vue +99 -0
- package/_Build/vue/modules/resource/Children/edit.vue +124 -0
- package/_Build/vue/modules/resource/Children/index.vue +42 -0
- package/_Build/vue/modules/resource/Children/partials/form.vue +111 -0
- package/_Build/vue/modules/resource/Children/show.vue +170 -0
- package/_Build/vue/modules/resource/index.js +562 -0
- package/_Build/vue/modules/resource/parent.vue +63 -0
- package/_Build/vue/modules/resource/trashable.js +104 -0
- package/_base.scss +0 -1
- package/_defaults.scss +2 -2
- package/components/_auth.scss +19 -61
- package/components/_datepicker.scss +1 -0
- package/components/_descriptions.scss +2 -0
- package/components/_footer.scss +1 -0
- package/components/_form.scss +18 -0
- package/components/_header.scss +3 -27
- package/components/_layout.scss +56 -0
- package/components/_menu.scss +0 -5
- package/components/_sidebar.scss +12 -27
- package/components/_table.scss +3 -0
- package/components/_token-display.scss +41 -0
- package/components/_wysiwyg2.scss +10 -0
- package/general.scss +1 -0
- package/index.js +31 -1
- package/package.json +7 -4
- package/_Build/vue/components/layout/sideBar.vue +0 -25
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +0 -259
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +0 -62
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +0 -98
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +0 -90
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +0 -181
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +0 -266
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +0 -36
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +0 -103
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +0 -173
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +0 -123
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +0 -36
- package/components/_input.scss +0 -0
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/AuthModal.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/Chip.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VPasswordValidation.vue → components/layout/PasswordValidation.vue} +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VRoleLegend.vue → components/layout/RoleLegend.vue} +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { merge } from "lodash";
|
|
2
|
+
import { h } from "vue";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { throttle } from "lodash";
|
|
5
|
+
|
|
6
|
+
import { columns, defaultResource, meta } from "../../../resource/index.js";
|
|
7
|
+
import userResource from "../PUsers/resource.js";
|
|
8
|
+
import teamsColumns from "./columns.js";
|
|
9
|
+
|
|
10
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
11
|
+
import VelRoleLegend from "../../../../components/layout/RoleLegend.vue";
|
|
12
|
+
import VelTableSorter from "../../../../components/layout/TableSorter.vue";
|
|
13
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
14
|
+
import VelCheckbox from "../../../../components/form/Checkbox.vue";
|
|
15
|
+
|
|
16
|
+
export default [
|
|
17
|
+
"teams",
|
|
18
|
+
{
|
|
19
|
+
icon: `icon-account-circle`,
|
|
20
|
+
api: {
|
|
21
|
+
params: {
|
|
22
|
+
index: ({ $route }) => ({
|
|
23
|
+
include: "company",
|
|
24
|
+
"filter[company_id]": $route.params.companiesId,
|
|
25
|
+
}),
|
|
26
|
+
show: () => ({
|
|
27
|
+
include: "company",
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
auditable: true,
|
|
32
|
+
trashable: true,
|
|
33
|
+
permissions: {
|
|
34
|
+
create: ({ $store }) => $store.getters.can("write teams"),
|
|
35
|
+
edit: ({ $store }) => $store.getters.can("write teams"),
|
|
36
|
+
delete: ({ $store }) => $store.getters.can("delete teams"),
|
|
37
|
+
},
|
|
38
|
+
...merge(columns(teamsColumns), {
|
|
39
|
+
index: {
|
|
40
|
+
layout: [
|
|
41
|
+
...defaultResource.index.layout,
|
|
42
|
+
() =>
|
|
43
|
+
h(VelRoleLegend, {
|
|
44
|
+
class: "mt-5",
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
show: {
|
|
49
|
+
tabs: [
|
|
50
|
+
...defaultResource.show.tabs,
|
|
51
|
+
({ model }) => ({
|
|
52
|
+
label: "Access control",
|
|
53
|
+
component: h(VelFormRole, {
|
|
54
|
+
overrides: model.overrides_roles_and_permissions,
|
|
55
|
+
form: { roles: model.roles.map((d) => d.id) },
|
|
56
|
+
readonly: true,
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
59
|
+
(props) => {
|
|
60
|
+
const { model, $store, $router, $route, ...rest } =
|
|
61
|
+
props;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
label: "Members",
|
|
65
|
+
component: h({
|
|
66
|
+
data: () => ({
|
|
67
|
+
scoped: true,
|
|
68
|
+
}),
|
|
69
|
+
mounted() {
|
|
70
|
+
this.emitter.on("reload-teams", () => {
|
|
71
|
+
this.reload();
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
beforeUnmount() {
|
|
75
|
+
this.emitter.off("reload-teams");
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
reload: throttle(function () {
|
|
79
|
+
this.$refs.members.reload();
|
|
80
|
+
this.$refs.users.reload();
|
|
81
|
+
}, 1000),
|
|
82
|
+
},
|
|
83
|
+
render() {
|
|
84
|
+
return h("div", [
|
|
85
|
+
h("h3", "Members"),
|
|
86
|
+
(() => {
|
|
87
|
+
const resource = meta(
|
|
88
|
+
...userResource,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
resource.api.params.index = ({
|
|
92
|
+
$route,
|
|
93
|
+
}) => ({
|
|
94
|
+
include: "company",
|
|
95
|
+
"filter[teams.id]":
|
|
96
|
+
$route.params.teamsId,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
resource.table.actions = [
|
|
100
|
+
({ model }) =>
|
|
101
|
+
h({
|
|
102
|
+
data: () => ({
|
|
103
|
+
loading: false,
|
|
104
|
+
}),
|
|
105
|
+
render() {
|
|
106
|
+
return h(
|
|
107
|
+
VelButton,
|
|
108
|
+
{
|
|
109
|
+
tag: "a",
|
|
110
|
+
size: "small",
|
|
111
|
+
type: "warning",
|
|
112
|
+
loading:
|
|
113
|
+
this
|
|
114
|
+
.loading,
|
|
115
|
+
onClick:
|
|
116
|
+
async () => {
|
|
117
|
+
this.loading = true;
|
|
118
|
+
|
|
119
|
+
await axios.delete(
|
|
120
|
+
`api/teams/${$route.params.teamsId}/users/${model.id}`,
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
this.emitter.emit(
|
|
124
|
+
"reload-teams",
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
"Remove",
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
const props = {
|
|
135
|
+
model,
|
|
136
|
+
$store,
|
|
137
|
+
$router,
|
|
138
|
+
$route,
|
|
139
|
+
...rest,
|
|
140
|
+
resource,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return h(
|
|
144
|
+
VelTableSorter,
|
|
145
|
+
merge(
|
|
146
|
+
resource.index.structure(
|
|
147
|
+
props,
|
|
148
|
+
),
|
|
149
|
+
{
|
|
150
|
+
ref: "members",
|
|
151
|
+
},
|
|
152
|
+
),
|
|
153
|
+
);
|
|
154
|
+
})(),
|
|
155
|
+
h("h3", "Users"),
|
|
156
|
+
h(VelCheckbox, {
|
|
157
|
+
label: "Only show users from this company",
|
|
158
|
+
class: "mt-2",
|
|
159
|
+
modelValue: this.scoped,
|
|
160
|
+
"onUpdate:modelValue": (value) => {
|
|
161
|
+
this.scoped = value;
|
|
162
|
+
this.$nextTick(() => {
|
|
163
|
+
this.$refs.users.reload();
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
}),
|
|
167
|
+
(() => {
|
|
168
|
+
const resource = meta(
|
|
169
|
+
...userResource,
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
resource.api.params.index = ({
|
|
173
|
+
$route,
|
|
174
|
+
}) => ({
|
|
175
|
+
include: "company",
|
|
176
|
+
"filter[company_id]": this
|
|
177
|
+
.scoped
|
|
178
|
+
? $route.params.companiesId
|
|
179
|
+
: null,
|
|
180
|
+
"filter[teams.id]": `!${$route.params.teamsId}`,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
resource.table.actions = [
|
|
184
|
+
({ model }) =>
|
|
185
|
+
h({
|
|
186
|
+
data: () => ({
|
|
187
|
+
loading: false,
|
|
188
|
+
}),
|
|
189
|
+
render() {
|
|
190
|
+
return h(
|
|
191
|
+
VelButton,
|
|
192
|
+
{
|
|
193
|
+
tag: "a",
|
|
194
|
+
size: "small",
|
|
195
|
+
type: "primary",
|
|
196
|
+
loading:
|
|
197
|
+
this
|
|
198
|
+
.loading,
|
|
199
|
+
onClick:
|
|
200
|
+
async () => {
|
|
201
|
+
this.loading = true;
|
|
202
|
+
|
|
203
|
+
await axios.post(
|
|
204
|
+
`api/teams/${$route.params.teamsId}/users`,
|
|
205
|
+
{
|
|
206
|
+
id: model.id,
|
|
207
|
+
},
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
this.emitter.emit(
|
|
211
|
+
"reload-teams",
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
"Add",
|
|
216
|
+
);
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
];
|
|
220
|
+
|
|
221
|
+
const props = {
|
|
222
|
+
model,
|
|
223
|
+
$store,
|
|
224
|
+
$router,
|
|
225
|
+
$route,
|
|
226
|
+
...rest,
|
|
227
|
+
resource,
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
return h(
|
|
231
|
+
VelTableSorter,
|
|
232
|
+
merge(
|
|
233
|
+
resource.index.structure(
|
|
234
|
+
props,
|
|
235
|
+
),
|
|
236
|
+
{
|
|
237
|
+
ref: "users",
|
|
238
|
+
},
|
|
239
|
+
),
|
|
240
|
+
);
|
|
241
|
+
})(),
|
|
242
|
+
]);
|
|
243
|
+
},
|
|
244
|
+
}),
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
}),
|
|
250
|
+
},
|
|
251
|
+
];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<vel-button @click="visible = true">Set Password</vel-button>
|
|
3
|
+
|
|
4
|
+
<SetPasswordDialog
|
|
5
|
+
v-if="visible"
|
|
6
|
+
:user-id="userId"
|
|
7
|
+
@close="visible = false"
|
|
8
|
+
@success="onSuccess"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
14
|
+
import SetPasswordDialog from "./SetPasswordDialog.vue";
|
|
15
|
+
import { ElNotification } from "element-plus";
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
components: {
|
|
19
|
+
VelButton,
|
|
20
|
+
SetPasswordDialog,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
userId: {
|
|
24
|
+
type: [Number, String],
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
model: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
visible: false,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
onSuccess(data) {
|
|
39
|
+
this.visible = false;
|
|
40
|
+
|
|
41
|
+
Object.assign(this.model, data);
|
|
42
|
+
|
|
43
|
+
ElNotification({
|
|
44
|
+
title: "Success",
|
|
45
|
+
message: "Password updated",
|
|
46
|
+
type: "success",
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
:model-value="true"
|
|
4
|
+
title="Set Password"
|
|
5
|
+
width="500px"
|
|
6
|
+
@close="$emit('close')"
|
|
7
|
+
>
|
|
8
|
+
<vel-basic
|
|
9
|
+
v-model="password"
|
|
10
|
+
name="password"
|
|
11
|
+
type="password"
|
|
12
|
+
label="Password"
|
|
13
|
+
placeholder="Enter new password"
|
|
14
|
+
class="AM-mb-2"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<vel-basic
|
|
18
|
+
v-model="passwordConfirmation"
|
|
19
|
+
name="password_confirmation"
|
|
20
|
+
type="password"
|
|
21
|
+
label="Confirm Password"
|
|
22
|
+
placeholder="Confirm new password"
|
|
23
|
+
class="AM-mb-2"
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<div class="AM-mb-2">
|
|
27
|
+
<p class="font-700 AM-mb-0.5">Password must contain:</p>
|
|
28
|
+
<p class="m-0">
|
|
29
|
+
{{ passwordLengthValid ? "✓" : "✗" }} At least 8 characters
|
|
30
|
+
</p>
|
|
31
|
+
<p class="m-0">{{ hasLetter ? "✓" : "✗" }} At least one letter</p>
|
|
32
|
+
<p class="m-0">
|
|
33
|
+
{{ hasNumberOrSymbol ? "✓" : "✗" }} At least one number or
|
|
34
|
+
symbol
|
|
35
|
+
</p>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<template #footer>
|
|
39
|
+
<el-button @click="$emit('close')">Cancel</el-button>
|
|
40
|
+
<el-button
|
|
41
|
+
type="primary"
|
|
42
|
+
:disabled="!canSubmit"
|
|
43
|
+
:loading="loading"
|
|
44
|
+
@click="submit"
|
|
45
|
+
>
|
|
46
|
+
Set Password
|
|
47
|
+
</el-button>
|
|
48
|
+
</template>
|
|
49
|
+
</el-dialog>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import { ElDialog, ElButton, ElNotification } from "element-plus";
|
|
54
|
+
import VelBasic from "../../../../components/form/basic.vue";
|
|
55
|
+
import axios from "axios";
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
components: {
|
|
59
|
+
ElDialog,
|
|
60
|
+
ElButton,
|
|
61
|
+
VelBasic,
|
|
62
|
+
},
|
|
63
|
+
props: {
|
|
64
|
+
userId: {
|
|
65
|
+
type: [Number, String],
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
emits: ["close", "success"],
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
password: "",
|
|
73
|
+
passwordConfirmation: "",
|
|
74
|
+
loading: false,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
passwordLengthValid() {
|
|
79
|
+
return this.password.length >= 8;
|
|
80
|
+
},
|
|
81
|
+
hasLetter() {
|
|
82
|
+
return /[a-zA-Z]/.test(this.password);
|
|
83
|
+
},
|
|
84
|
+
hasNumberOrSymbol() {
|
|
85
|
+
return (
|
|
86
|
+
/[0-9]/.test(this.password) ||
|
|
87
|
+
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(this.password)
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
passwordValid() {
|
|
91
|
+
return (
|
|
92
|
+
this.passwordLengthValid &&
|
|
93
|
+
this.hasLetter &&
|
|
94
|
+
this.hasNumberOrSymbol
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
canSubmit() {
|
|
98
|
+
return (
|
|
99
|
+
this.passwordValid &&
|
|
100
|
+
this.password === this.passwordConfirmation &&
|
|
101
|
+
this.password.length > 0
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
async submit() {
|
|
107
|
+
this.loading = true;
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const res = await axios.post(
|
|
111
|
+
`/api/users/${this.userId}/set-password`,
|
|
112
|
+
{
|
|
113
|
+
password: this.password,
|
|
114
|
+
password_confirmation: this.passwordConfirmation,
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
this.$emit("success", res.data.data);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
if (e.response?.status === 422) {
|
|
121
|
+
const errors = e.response.data.errors || {};
|
|
122
|
+
const message =
|
|
123
|
+
Object.values(errors).flat().join("\n") ||
|
|
124
|
+
e.response.data.message;
|
|
125
|
+
|
|
126
|
+
ElNotification({
|
|
127
|
+
title: "Validation Error",
|
|
128
|
+
message,
|
|
129
|
+
type: "error",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
} finally {
|
|
133
|
+
this.loading = false;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
</script>
|