@fishawack/lab-velocity 2.0.0-beta.1 → 2.0.0-beta.10
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 +160 -38
- 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/Spinner.vue +5 -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 +259 -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 +181 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +267 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +36 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +113 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +101 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +112 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +174 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +123 -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 +117 -0
- package/_Build/vue/modules/AuthModule/components/VBreadcrumbs.vue +33 -0
- package/_Build/vue/modules/AuthModule/components/VFormFooter.vue +52 -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 +136 -0
- package/_Build/vue/modules/AuthModule/components/VTableSorter.vue +252 -0
- package/_Build/vue/modules/AuthModule/js/FakeAPI.js +78 -0
- package/_Build/vue/modules/AuthModule/js/axios.js +81 -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 +163 -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 +101 -0
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +147 -0
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +91 -0
- package/_Build/vue/modules/AuthModule/routes/login.vue +139 -0
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +39 -0
- package/_Build/vue/modules/AuthModule/routes/loginheadless.vue +21 -0
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +132 -0
- package/_Build/vue/modules/AuthModule/routes/logout.vue +19 -0
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +25 -0
- package/_Build/vue/modules/AuthModule/routes/register.vue +171 -0
- package/_Build/vue/modules/AuthModule/routes/reset.vue +133 -0
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +120 -0
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +35 -0
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +30 -0
- package/_Build/vue/modules/AuthModule/routes/verify.vue +110 -0
- package/_base.scss +0 -1
- package/_defaults.scss +2 -13
- package/_variables.scss +9 -4
- package/{modules/_AuthModule.scss → components/_auth.scss} +19 -68
- package/package.json +3 -8
- package/vendor.scss +0 -1
- package/components/_input.scss +0 -0
- package/modules/_AuthVariables.scss +0 -7
- /package/{modules → components}/_modal.scss +0 -0
|
@@ -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 = console.log, 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 }) {
|
|
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 mb-0 color-21">
|
|
7
|
+
<strong class="">Company: {{ $route.query.company }}</strong>
|
|
8
|
+
</p>
|
|
9
|
+
<p class="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,163 @@
|
|
|
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="mt-2 mb-0">
|
|
11
|
+
Please complete the fields below to change your
|
|
12
|
+
password.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<el-input
|
|
16
|
+
class="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="mt-2 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 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
|
|
70
|
+
tag="router-link"
|
|
71
|
+
type="primary"
|
|
72
|
+
:to="{ name: $store.state.auth.redirect }"
|
|
73
|
+
>
|
|
74
|
+
<span v-text="'Continue'" />
|
|
75
|
+
</elButton>
|
|
76
|
+
</div>
|
|
77
|
+
</form>
|
|
78
|
+
</section>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
import Form from "form-backend-validation";
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
data() {
|
|
87
|
+
return {
|
|
88
|
+
form: new Form(
|
|
89
|
+
{
|
|
90
|
+
email: this.$store.state.auth.user?.email,
|
|
91
|
+
password: "",
|
|
92
|
+
current_password: "",
|
|
93
|
+
},
|
|
94
|
+
{ resetOnSuccess: false },
|
|
95
|
+
),
|
|
96
|
+
isPasswordValid: false,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
mounted() {
|
|
101
|
+
this.$store.dispatch("getUser");
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
methods: {
|
|
105
|
+
async onSubmit() {
|
|
106
|
+
this.loading = true;
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
await this.form.put("/user/password");
|
|
110
|
+
await this.login();
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.log(e);
|
|
113
|
+
} finally {
|
|
114
|
+
this.loading = false;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
async login() {
|
|
118
|
+
this.loading = true;
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const res = await this.form.post("/login");
|
|
122
|
+
|
|
123
|
+
if (res["logged-in"]) {
|
|
124
|
+
try {
|
|
125
|
+
await this.$store.dispatch("logout");
|
|
126
|
+
} catch (e) {}
|
|
127
|
+
|
|
128
|
+
await this.form.post("/login");
|
|
129
|
+
}
|
|
130
|
+
} catch (e) {
|
|
131
|
+
console.log(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
|
+
},
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
metaInfo() {
|
|
151
|
+
return {
|
|
152
|
+
title: "Reset Password",
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
components: {
|
|
157
|
+
VPasswordValidation: require("./../components/VPasswordValidation.vue")
|
|
158
|
+
.default,
|
|
159
|
+
elInput: require("../../../components/form/basic.vue").default,
|
|
160
|
+
elButton: require("../../../components/basic/Button.vue").default,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
</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>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<h1 class="h2 h2--small">Sorry, your password reset has expired</h1>
|
|
3
|
+
|
|
4
|
+
<p class="mt-2 mb-0 color-highlight">
|
|
5
|
+
<strong class="">Email: {{ form?.email }}</strong>
|
|
6
|
+
</p>
|
|
7
|
+
<p class="mt-0.5">
|
|
8
|
+
For security, password reset requests are only
|
|
9
|
+
<strong>active for 1 hour</strong>. If you still want to reset your
|
|
10
|
+
password, please request a new password reset-link.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<form class="form" @submit.prevent="submit">
|
|
14
|
+
<el-input
|
|
15
|
+
class="hidden"
|
|
16
|
+
v-model="form.email"
|
|
17
|
+
label="Email address"
|
|
18
|
+
name="email"
|
|
19
|
+
:error="form.errors"
|
|
20
|
+
type="email"
|
|
21
|
+
placeholder="Email "
|
|
22
|
+
required
|
|
23
|
+
/>
|
|
24
|
+
<elButton
|
|
25
|
+
native-type="submit"
|
|
26
|
+
type="primary"
|
|
27
|
+
:disabled="form.processing"
|
|
28
|
+
:loading="form.processing"
|
|
29
|
+
@click="onSubmit"
|
|
30
|
+
>
|
|
31
|
+
Request new reset-link
|
|
32
|
+
</elButton>
|
|
33
|
+
|
|
34
|
+
<p class="disclaimer mt-3">
|
|
35
|
+
<router-link class="color-1 underline" :to="{ name: 'auth.login' }">
|
|
36
|
+
Back to Sign in
|
|
37
|
+
</router-link>
|
|
38
|
+
</p>
|
|
39
|
+
</form>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import Form from "form-backend-validation";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
components: {
|
|
47
|
+
elInput: require("../../../components/form/basic.vue").default,
|
|
48
|
+
elButton: require("../../../components/basic/Button.vue").default,
|
|
49
|
+
},
|
|
50
|
+
data: () => ({
|
|
51
|
+
form: new Form(
|
|
52
|
+
{
|
|
53
|
+
email: "",
|
|
54
|
+
},
|
|
55
|
+
{ resetOnSuccess: false },
|
|
56
|
+
),
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
methods: {
|
|
60
|
+
async onSubmit() {
|
|
61
|
+
try {
|
|
62
|
+
await this.form.post("/forgot-password");
|
|
63
|
+
|
|
64
|
+
this.$router.push({
|
|
65
|
+
name: "auth.success-forgot",
|
|
66
|
+
query: { email: this.form.email },
|
|
67
|
+
});
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.log(e);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
mounted() {
|
|
75
|
+
this.form.email = this.$route.query.email;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<h1 class="h2 h2--small">Verification link expired</h1>
|
|
3
|
+
|
|
4
|
+
<form class="form" @submit.prevent="submit">
|
|
5
|
+
<p class="mt-2 mb-0 color-highlight">
|
|
6
|
+
<strong class="">Email: {{ form?.email }}</strong>
|
|
7
|
+
</p>
|
|
8
|
+
<p class="mt-0.5">
|
|
9
|
+
This email verification link has expired. Not to worry, we can email
|
|
10
|
+
you a new one.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<el-input
|
|
14
|
+
class="mt-2 mb-2.5 hidden"
|
|
15
|
+
v-model="form.email"
|
|
16
|
+
label="Email address"
|
|
17
|
+
name="email"
|
|
18
|
+
:error="form.errors"
|
|
19
|
+
type="email"
|
|
20
|
+
placeholder="Email "
|
|
21
|
+
required
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<elButton
|
|
25
|
+
native-type="submit"
|
|
26
|
+
type="primary"
|
|
27
|
+
:disabled="form.processing"
|
|
28
|
+
:loading="form.processing"
|
|
29
|
+
@click="onSubmit"
|
|
30
|
+
>
|
|
31
|
+
Re-send verification link
|
|
32
|
+
</elButton>
|
|
33
|
+
</form>
|
|
34
|
+
|
|
35
|
+
<p class="disclaimer mt-3">
|
|
36
|
+
Having trouble singing in?
|
|
37
|
+
<a :href="$store.state.auth.contact" class="underline">Contact us</a>
|
|
38
|
+
</p>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import Form from "form-backend-validation";
|
|
43
|
+
import { ElNotification } from "element-plus";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
components: {
|
|
47
|
+
elInput: require("../../../components/form/basic.vue").default,
|
|
48
|
+
elButton: require("../../../components/basic/Button.vue").default,
|
|
49
|
+
},
|
|
50
|
+
data: () => ({
|
|
51
|
+
form: new Form(
|
|
52
|
+
{
|
|
53
|
+
email: "",
|
|
54
|
+
},
|
|
55
|
+
{ resetOnSuccess: false },
|
|
56
|
+
),
|
|
57
|
+
notification: null,
|
|
58
|
+
}),
|
|
59
|
+
|
|
60
|
+
methods: {
|
|
61
|
+
async onSubmit() {
|
|
62
|
+
try {
|
|
63
|
+
if (this.notification) {
|
|
64
|
+
this.notification.close();
|
|
65
|
+
this.notification = null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await this.form.post("/email/verification-notification");
|
|
69
|
+
|
|
70
|
+
ElNotification.success({
|
|
71
|
+
message: "Email has been re-sent",
|
|
72
|
+
duration: 10000,
|
|
73
|
+
class: "el-notification--success el-notification--right-override",
|
|
74
|
+
});
|
|
75
|
+
} catch (e) {
|
|
76
|
+
if (e.response && e.response.status === 429) {
|
|
77
|
+
this.notification = ElNotification({
|
|
78
|
+
type: "warning",
|
|
79
|
+
message: "Please allow 10 minutes before re-requesting",
|
|
80
|
+
duration: 0,
|
|
81
|
+
class: "el-notification--warning el-notification--right-override",
|
|
82
|
+
});
|
|
83
|
+
} else if (e.response && e.response.status === 422) {
|
|
84
|
+
this.notification = ElNotification({
|
|
85
|
+
type: "error",
|
|
86
|
+
message: e.response.data.message,
|
|
87
|
+
duration: 0,
|
|
88
|
+
class: "el-notification--error el-notification--right-override",
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
console.log(e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
async mounted() {
|
|
98
|
+
this.form.email = this.$route.query.email;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<section id="resetPasswordForm">
|
|
4
|
+
<h1
|
|
5
|
+
class="h2 h2--small"
|
|
6
|
+
v-html="!form.successful ? 'Welcome' : 'Success'"
|
|
7
|
+
/>
|
|
8
|
+
<form class="form" @submit.prevent="submit">
|
|
9
|
+
<div v-if="!form.successful">
|
|
10
|
+
<p class="mt-2 mb-0 color-highlight">
|
|
11
|
+
<strong class=""
|
|
12
|
+
>Email:
|
|
13
|
+
{{ $store.state?.auth?.user?.email }}</strong
|
|
14
|
+
>
|
|
15
|
+
</p>
|
|
16
|
+
<p class="mt-0.5">
|
|
17
|
+
<strong
|
|
18
|
+
>Hello {{ $store.state?.auth?.user?.name }}</strong
|
|
19
|
+
>, and welcome to {{ $root.appName }}. To maintain
|
|
20
|
+
security, anyone signing in with a one-time-password
|
|
21
|
+
must <strong>create a new password</strong> the first
|
|
22
|
+
time they access the {{ $root.appName }} portal.
|
|
23
|
+
</p>
|
|
24
|
+
<el-input
|
|
25
|
+
v-model="form.password"
|
|
26
|
+
class="mt-2"
|
|
27
|
+
label="New Password"
|
|
28
|
+
placeholder="Enter new password"
|
|
29
|
+
name="password"
|
|
30
|
+
:error="form.errors"
|
|
31
|
+
type="password"
|
|
32
|
+
autocomplete="new-password"
|
|
33
|
+
required
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<VPasswordValidation
|
|
37
|
+
:password="form.password"
|
|
38
|
+
@passwordValid="updatePasswordValidity"
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<elButton
|
|
42
|
+
native-type="submit"
|
|
43
|
+
class="mt-3"
|
|
44
|
+
type="primary"
|
|
45
|
+
:disabled="form.processing || !isPasswordValid"
|
|
46
|
+
:loading="form.processing"
|
|
47
|
+
@click="onSubmit"
|
|
48
|
+
>
|
|
49
|
+
<span v-text="'Update password'" />
|
|
50
|
+
</elButton>
|
|
51
|
+
</div>
|
|
52
|
+
<div v-else>
|
|
53
|
+
<strong class=""
|
|
54
|
+
>Email: {{ $store.state.auth?.user?.email }}</strong
|
|
55
|
+
>
|
|
56
|
+
<p v-text="`Your password has been updated.`" />
|
|
57
|
+
<elButton
|
|
58
|
+
tag="router-link"
|
|
59
|
+
type="primary"
|
|
60
|
+
:to="{ name: $store.state.auth.redirect }"
|
|
61
|
+
>
|
|
62
|
+
<span v-text="'Continue'" />
|
|
63
|
+
</elButton>
|
|
64
|
+
</div>
|
|
65
|
+
</form>
|
|
66
|
+
</section>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import Form from "form-backend-validation";
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
data() {
|
|
75
|
+
return {
|
|
76
|
+
form: new Form(
|
|
77
|
+
{
|
|
78
|
+
email: this.$store.state.auth.user?.email,
|
|
79
|
+
password: "",
|
|
80
|
+
},
|
|
81
|
+
{ resetOnSuccess: false },
|
|
82
|
+
),
|
|
83
|
+
isPasswordValid: false,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
mounted() {
|
|
88
|
+
this.$store.dispatch("getUser");
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
methods: {
|
|
92
|
+
async onSubmit() {
|
|
93
|
+
this.loading = true;
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
await this.form.put("/user/password");
|
|
97
|
+
await this.login();
|
|
98
|
+
} catch (e) {
|
|
99
|
+
console.log(e);
|
|
100
|
+
} finally {
|
|
101
|
+
this.loading = false;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
async login() {
|
|
105
|
+
this.loading = true;
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
const res = await this.form.post("/login");
|
|
109
|
+
|
|
110
|
+
if (res["logged-in"]) {
|
|
111
|
+
try {
|
|
112
|
+
await this.$store.dispatch("logout");
|
|
113
|
+
} catch (e) {}
|
|
114
|
+
|
|
115
|
+
await this.form.post("/login");
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
console.log(e);
|
|
119
|
+
} finally {
|
|
120
|
+
this.loading = false;
|
|
121
|
+
await this.postLogin();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
async postLogin() {
|
|
126
|
+
const { data: user } = await this.$store.dispatch("getUser");
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
updatePasswordValidity(isValid) {
|
|
130
|
+
this.isPasswordValid = isValid;
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
metaInfo() {
|
|
135
|
+
return {
|
|
136
|
+
title: "Reset Password",
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
components: {
|
|
141
|
+
VPasswordValidation: require("./../components/VPasswordValidation.vue")
|
|
142
|
+
.default,
|
|
143
|
+
elInput: require("../../../components/form/basic.vue").default,
|
|
144
|
+
elButton: require("../../../components/basic/Button.vue").default,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
</script>
|