@fishawack/lab-velocity 1.3.2 → 1.4.1

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.
@@ -24,6 +24,14 @@ export function authRoutes(node, store, nested = 'auth') {
24
24
  .default,
25
25
  name: `${nested}.login`
26
26
  },
27
+ {
28
+ path: "force-login",
29
+ component: node
30
+ ? ""
31
+ : require("../routes/loginheadless.vue")
32
+ .default,
33
+ name: `${nested}.force-login`
34
+ },
27
35
  {
28
36
  path: "callback",
29
37
  component: node
@@ -123,7 +131,7 @@ export function authRoutes(node, store, nested = 'auth') {
123
131
  export function configureRoutes(router) {
124
132
 
125
133
  router.beforeEach((to, from, next) => {
126
- const { authenticated, user, authBase, redirect, forcePasswordChange } = store.state.auth;
134
+ const { authenticated, user, authBase, redirect, forcePasswordChange, autoLogin } = store.state.auth;
127
135
 
128
136
  const admin = to.path.includes("/admin");
129
137
 
@@ -133,7 +141,11 @@ export function configureRoutes(router) {
133
141
  if (admin && !user?.admin) {
134
142
  next({ name: redirect });
135
143
  } else if (to.name === "login" || to.name === `${authBase}.login`) {
136
- next({ name: redirect });
144
+ if(autoLogin) {
145
+ next({ name: `${authBase}.force-login` });
146
+ } else {
147
+ next({ name: redirect });
148
+ }
137
149
  } else if (
138
150
  !user?.email_verified_at &&
139
151
  to.matched.some((d) => d.meta.guest) !== true
@@ -147,8 +159,14 @@ export function configureRoutes(router) {
147
159
  next();
148
160
  } else if (admin) {
149
161
  next({ name: "login" });
162
+ } else if (to.path === "/callback") {
163
+ next({ name: `${authBase}.callback` });
150
164
  } else {
151
- next({ name: `${authBase}.login` });
165
+ if(autoLogin === true) {
166
+ next({ name: `${authBase}.force-login` });
167
+ } else {
168
+ next({ name: `${authBase}.login` });
169
+ }
152
170
  }
153
171
  }
154
172
  });
@@ -9,7 +9,8 @@ const store = {
9
9
  forcePasswordChange: false,
10
10
  intended: null,
11
11
  user: null,
12
- redirect: process.env.HYDRATE_REDIRECT ?? 'index'
12
+ redirect: process.env.HYDRATE_REDIRECT ?? 'index',
13
+ autoLogin: process.env.HYDRATE_ADMIN === 'true' ? true: false,
13
14
  }
14
15
  },
15
16
 
@@ -40,9 +40,7 @@ export default {
40
40
  },
41
41
 
42
42
  mounted() {
43
- if (this.$route.query.authenticated) {
44
- this.postLogin();
45
- }
43
+ this.postLogin();
46
44
  },
47
45
  };
48
46
  </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <!-- Set Spinner -->
3
+ <div class="mx-auto">
4
+ <VLoader class="mx-auto" />
5
+ <p v-text="`Logging in...`"/>
6
+ </div>
7
+ </template>
8
+
9
+
10
+ <script>
11
+ export default {
12
+ mounted(){
13
+ window.location = '/login';
14
+ }
15
+ }
16
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "1.3.2",
3
+ "version": "1.4.1",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",