@fishawack/lab-velocity 1.2.0 → 1.2.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/AuthModule/js/AuthAxios.js +4 -2
- package/AuthModule/js/AuthRoutes.js +52 -0
- package/AuthModule/js/AuthStore.js +48 -54
- package/AuthModule/routes/force-reset.vue +1 -1
- package/AuthModule/routes/login.vue +2 -2
- package/AuthModule/routes/logincallback.vue +3 -4
- package/AuthModule/routes/register.vue +2 -2
- package/modules/_AuthModule.scss +23 -17
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function setAxiosDefaults() {
|
|
4
4
|
axios.defaults.baseURL = process.env.APP_URL;
|
|
5
5
|
axios.defaults.withCredentials = true;
|
|
6
6
|
axios.defaults.withXSRFToken = true;
|
|
@@ -22,4 +22,6 @@ axios.interceptors.response.use(null, (error) => {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
return Promise.reject(error);
|
|
25
|
-
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
setAxiosDefaults();
|
|
@@ -100,5 +100,57 @@ export function authRoutes(node, store, nested = 'auth') {
|
|
|
100
100
|
footer: false,
|
|
101
101
|
fullpageModal: true,
|
|
102
102
|
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
path: "/admin",
|
|
106
|
+
redirect: () => {
|
|
107
|
+
const { authenticated } = store.state.auth;
|
|
108
|
+
|
|
109
|
+
if (!authenticated) {
|
|
110
|
+
store.commit("setAuth", true);
|
|
111
|
+
window.location = `${process.env.APP_URL}/login`;
|
|
112
|
+
} else {
|
|
113
|
+
window.location = `${process.env.APP_URL}/`;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
name: "admin",
|
|
117
|
+
meta: {
|
|
118
|
+
guest: true,
|
|
119
|
+
},
|
|
103
120
|
}]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function configureRoutes(router) {
|
|
124
|
+
|
|
125
|
+
router.beforeEach((to, from, next) => {
|
|
126
|
+
const { authenticated, user, authBase, redirect } = store.state.auth;
|
|
127
|
+
|
|
128
|
+
const admin = to.path.includes("/admin");
|
|
129
|
+
|
|
130
|
+
if (to.query.verified) {
|
|
131
|
+
next({ name: `${authBase}.success-verify` });
|
|
132
|
+
} else if (authenticated) {
|
|
133
|
+
if (admin && !user?.admin) {
|
|
134
|
+
next({ name: redirect });
|
|
135
|
+
} else if (to.name === "login" || to.name === `${authBase}.login`) {
|
|
136
|
+
next({ name: redirect });
|
|
137
|
+
} else if (
|
|
138
|
+
!user?.email_verified_at &&
|
|
139
|
+
to.matched.some((d) => d.meta.guest) !== true
|
|
140
|
+
) {
|
|
141
|
+
next({ name: `${authBase}.verify` });
|
|
142
|
+
} else {
|
|
143
|
+
next();
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
if (to.matched.some((d) => d.meta.guest) === true) {
|
|
147
|
+
next();
|
|
148
|
+
} else if (admin) {
|
|
149
|
+
next({ name: "login" });
|
|
150
|
+
} else {
|
|
151
|
+
next({ name: `${authBase}.login` });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
104
156
|
}
|
|
@@ -1,64 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import axios from "axios";
|
|
3
|
-
import { createStore } from "vuex";
|
|
4
|
-
import VuexPersistedState from 'vuex-persistedstate';
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
const store = {
|
|
5
|
+
state() {
|
|
6
|
+
return {
|
|
7
|
+
authBase : process.env.HYDRATE_ROUTE ?? 'auth',
|
|
8
|
+
authenticated : false,
|
|
9
|
+
intended: null,
|
|
10
|
+
user: null,
|
|
11
|
+
redirect: process.env.HYDRATE_REDIRECT ?? 'index'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
state
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
mutations: {
|
|
16
|
+
setAuth(state, value) {
|
|
17
|
+
state.authenticated = value;
|
|
18
|
+
|
|
19
|
+
if (!value) {
|
|
20
|
+
this.commit("setUser", null);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setUser(state, value) {
|
|
24
|
+
state.user = value;
|
|
25
|
+
|
|
26
|
+
if(window.dataLayer){
|
|
27
|
+
window.dataLayer.push({ event: "logic", user: value });
|
|
16
28
|
}
|
|
17
29
|
},
|
|
30
|
+
setIntended(state, value) {
|
|
31
|
+
state.intended = value;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
18
34
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if(window.dataLayer){
|
|
33
|
-
window.dataLayer.push({ event: "logic", user: value });
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
setIntended(state, value) {
|
|
37
|
-
state.intended = value;
|
|
38
|
-
},
|
|
35
|
+
actions: {
|
|
36
|
+
getUser({ commit }, { errors, query = "" }) {
|
|
37
|
+
return axios
|
|
38
|
+
.get(`/api/user/self${query}`, {
|
|
39
|
+
params: {
|
|
40
|
+
include: "company"
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.then((res) => {
|
|
44
|
+
commit("setUser", res.data.data);
|
|
45
|
+
return res.data.data;
|
|
46
|
+
})
|
|
47
|
+
.catch(errors);
|
|
39
48
|
},
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
include: "company"
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
.then((res) => {
|
|
50
|
-
commit("setUser", res.data.data);
|
|
51
|
-
return res.data.data;
|
|
52
|
-
})
|
|
53
|
-
.catch(errors);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
logout({ commit }, { errors }) {
|
|
57
|
-
commit("setAuth", false);
|
|
58
|
-
commit("setUser", null);
|
|
59
|
-
|
|
60
|
-
return axios.post("/logout");
|
|
61
|
-
},
|
|
50
|
+
logout({ commit }, { errors }) {
|
|
51
|
+
commit("setAuth", false);
|
|
52
|
+
commit("setUser", null);
|
|
53
|
+
|
|
54
|
+
return axios.post("/logout");
|
|
62
55
|
},
|
|
63
|
-
}
|
|
64
|
-
}
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export default store;
|
|
@@ -117,8 +117,8 @@ export default {
|
|
|
117
117
|
window.dataLayer.push({ event: "login", user });
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
if (this.$store.state.intended) {
|
|
121
|
-
this.$router.push(this.$store.state.intended);
|
|
120
|
+
if (this.$store.state.auth.intended) {
|
|
121
|
+
this.$router.push(this.$store.state.auth.intended);
|
|
122
122
|
} else {
|
|
123
123
|
this.$router.push({ name: "members" });
|
|
124
124
|
// Problem here
|
|
@@ -29,11 +29,10 @@ export default {
|
|
|
29
29
|
window.dataLayer.push({ event: "login", user });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (this.$store.state.intended) {
|
|
33
|
-
this.$router.push(this.$store.state.intended);
|
|
32
|
+
if (this.$store.state.auth.intended) {
|
|
33
|
+
this.$router.push(this.$store.state.auth.intended);
|
|
34
34
|
} else {
|
|
35
|
-
this.$router.push({ name:
|
|
36
|
-
// Problem Here
|
|
35
|
+
this.$router.push({ name: this.$store.state.auth.redirect });
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
this.$store.commit("setIntended", null);
|
|
@@ -129,8 +129,8 @@ export default {
|
|
|
129
129
|
window.dataLayer.push({ event: "login", user });
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
if (this.$store.state.intended) {
|
|
133
|
-
this.$router.push(this.$store.state.intended);
|
|
132
|
+
if (this.$store.state.auth.intended) {
|
|
133
|
+
this.$router.push(this.$store.state.auth.intended);
|
|
134
134
|
} else {
|
|
135
135
|
this.$router.push({ name: `${this.$store.state.auth.authBase}.verify` });
|
|
136
136
|
// Problem Here
|
package/modules/_AuthModule.scss
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
background-color: black;
|
|
7
7
|
height: 100vh;
|
|
8
8
|
width: 100%;
|
|
9
|
-
background: url('../media/content/images/hero-
|
|
9
|
+
background: url('../media/content/images/hero-auth-background-desktop.jpg') center top no-repeat;
|
|
10
10
|
background-size: cover;
|
|
11
11
|
z-index: 10;
|
|
12
12
|
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
width: 13.3rem;
|
|
15
15
|
z-index: 99;
|
|
16
16
|
}
|
|
17
|
+
@include breakpoint (max-width $tabletMax) {
|
|
18
|
+
background: url('../media/content/images/hero-auth-background-tablet.jpg') center top no-repeat;
|
|
19
|
+
}
|
|
20
|
+
@include breakpoint (max-width $mobileMax) {
|
|
21
|
+
background: url('../media/content/images/hero-auth-background-mobile.jpg') center top no-repeat;
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
.AuthModule__form {
|
|
@@ -33,27 +39,27 @@
|
|
|
33
39
|
padding: 24px;
|
|
34
40
|
width: calc(100% - 80px);
|
|
35
41
|
h2 .h2 {
|
|
36
|
-
font-size:
|
|
37
|
-
line-height:
|
|
42
|
+
font-size: 24px;
|
|
43
|
+
line-height: 32px;
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
h2, .h2 {
|
|
42
|
-
line-height:
|
|
43
|
-
font-size:
|
|
48
|
+
line-height: 50px;
|
|
49
|
+
font-size: 48px;
|
|
44
50
|
}
|
|
45
51
|
.h2--small {
|
|
46
|
-
font-size:
|
|
47
|
-
line-height:
|
|
52
|
+
font-size: 36px;
|
|
53
|
+
line-height: 44px;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
p {
|
|
51
|
-
font-size:
|
|
52
|
-
line-height:
|
|
53
|
-
margin-bottom:
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
line-height: 20px;
|
|
59
|
+
margin-bottom: 24px;
|
|
54
60
|
letter-spacing: -0.1px;
|
|
55
61
|
&.disclaimer {
|
|
56
|
-
font-size:
|
|
62
|
+
font-size: 12px;
|
|
57
63
|
color: rgba($color1, 0.5);
|
|
58
64
|
margin: 0;
|
|
59
65
|
}
|
|
@@ -61,8 +67,8 @@
|
|
|
61
67
|
color: $color1;
|
|
62
68
|
}
|
|
63
69
|
&.form__error {
|
|
64
|
-
font-size:
|
|
65
|
-
line-height:
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
line-height: 18px;
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
|
|
@@ -81,13 +87,13 @@
|
|
|
81
87
|
&.error {
|
|
82
88
|
.form__input {
|
|
83
89
|
.el-input__wrapper {
|
|
84
|
-
border: 0.
|
|
90
|
+
border: 0.4px solid red;
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
.form__input.error {
|
|
88
94
|
border:none;
|
|
89
95
|
.el-input__wrapper {
|
|
90
|
-
border: 0.
|
|
96
|
+
border: 0.4px solid red;
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
}
|
|
@@ -104,12 +110,12 @@
|
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
.vel-basic__label {
|
|
107
|
-
font-size:
|
|
113
|
+
font-size: 12px;
|
|
108
114
|
color: rgba($color1, 0.5);
|
|
109
115
|
}
|
|
110
116
|
.vel-basic__textbox {
|
|
111
117
|
--el-border-color:#CFD8DD;
|
|
112
|
-
font-size:
|
|
118
|
+
font-size: 14px;
|
|
113
119
|
padding-bottom: $am-spacing * 2.5;
|
|
114
120
|
|
|
115
121
|
.el-input__inner {
|