@fishawack/lab-velocity 1.1.1 → 1.2.0

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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="mt-2">
3
- <p class="font-700 mb-0.5">Your password must contain:</p>
2
+ <div class="">
3
+ <p class="font-700 AM-mb-0.5">Your password must contain:</p>
4
4
  <p class="flex m-0">
5
5
  <GSvg name="icon-list-tick" embed artboard class="mr-0.5 icon icon--0.4 fill-7"
6
6
  v-if="passwordLengthValid" />
@@ -12,7 +12,7 @@
12
12
  <GSvg name="icon-list-tick" embed artboard class="mr-0.5 icon icon--0.4 fill-3" v-else />
13
13
  At least one letter
14
14
  </p>
15
- <p class="flex mt-0 ml-0 mr-0 mb-3">
15
+ <p class="flex AM-mt-0 ml-0 mr-0 AM-mb-3">
16
16
  <GSvg name="icon-list-tick" embed artboard class="mr-0.5 icon icon--0.4 fill-7" v-if="hasNumberOrSymbol" />
17
17
  <GSvg name="icon-list-tick" embed artboard class="mr-0.5 icon icon--0.4 fill-3" v-else />
18
18
  At least one number or symbol
@@ -0,0 +1,25 @@
1
+ import axios from "axios";
2
+
3
+ export default function setAxiosDefaults() {
4
+ axios.defaults.baseURL = process.env.APP_URL;
5
+ axios.defaults.withCredentials = true;
6
+ axios.defaults.withXSRFToken = true;
7
+ }
8
+
9
+ // Some libraries will utilize the globally available version of axios so make sure it's our exact axios instance
10
+ // Redirect to login page if 401
11
+ axios.interceptors.response.use(null, (error) => {
12
+ if (error.response) {
13
+
14
+ if (error.response.status === 401) {
15
+ store.commit("setAuth", false);
16
+ router.push({ name: `${store.state.auth.authBase}.login` });
17
+ }
18
+
19
+ if (error.response.status === 404) {
20
+ router.push({ name: "index" });
21
+ }
22
+ }
23
+
24
+ return Promise.reject(error);
25
+ });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  export function authRoutes(node, store, nested = 'auth') {
3
- return {
3
+ return [{
4
4
  path: '/'+nested,
5
5
  name: nested,
6
6
  component: require("../routes/container.vue").default,
@@ -100,5 +100,5 @@ export function authRoutes(node, store, nested = 'auth') {
100
100
  footer: false,
101
101
  fullpageModal: true,
102
102
  },
103
- }
103
+ }]
104
104
  }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ import axios from "axios";
3
+ import { createStore } from "vuex";
4
+ import VuexPersistedState from 'vuex-persistedstate';
5
+
6
+ export function initAuthStore(store) {
7
+
8
+ store.registerModule('auth',{
9
+ state() {
10
+ return {
11
+ authBase : process.env.HYDRATE_ROUTE ?? 'auth',
12
+ authenticated : false,
13
+ intended: null,
14
+ user: null,
15
+ redirect: process.env.HYDRATE_REDIRECT ?? 'index'
16
+ }
17
+ },
18
+
19
+ mutations: {
20
+ setAuth(state, value) {
21
+ state.authenticated = value;
22
+
23
+ if (!value) {
24
+ this.commit("setUser", null);
25
+ }
26
+ },
27
+ setUser(state, value) {
28
+ console.log("we are setting the user");
29
+ console.log(value);
30
+ state.user = value;
31
+
32
+ if(window.dataLayer){
33
+ window.dataLayer.push({ event: "logic", user: value });
34
+ }
35
+ },
36
+ setIntended(state, value) {
37
+ state.intended = value;
38
+ },
39
+ },
40
+
41
+ actions: {
42
+ getUser({ commit }, { errors, query = "" }) {
43
+ return axios
44
+ .get(`/api/user/self${query}`, {
45
+ params: {
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
+ },
62
+ },
63
+ });
64
+ }
@@ -3,19 +3,20 @@
3
3
  <section id="resetPasswordForm">
4
4
  <h1 class="h2">Account already exists</h1>
5
5
 
6
- <p class="mt mb-0 color-21">
6
+ <p class="mt AM-mb-0 color-21">
7
7
  <strong class="">Company: {{ $route.query.company }}</strong>
8
8
  </p>
9
- <p class="mt-0.5">
9
+ <p class="AM-mt-0.5">
10
10
  Your company already has an active account.
11
11
  </p>
12
12
 
13
- <router-link
14
- :to="{name: `${$store.state.authBase}.login`}"
15
- class="button button--primary px-2"
13
+ <elButton
14
+ tag="router-link"
15
+ :to="{name: `${$store.state.auth.authBase}.login`}"
16
+ type="primary"
16
17
  >
17
18
  <span v-text="'Sign in'" />
18
- </router-link>
19
+ </elButton>
19
20
  </section>
20
21
  </div>
21
22
  </template>
@@ -27,5 +28,8 @@ export default {
27
28
  title: "Account Exists | Error",
28
29
  };
29
30
  },
31
+ components: {
32
+ elButton: require('../../basic/Button.vue').default,
33
+ }
30
34
  };
31
35
  </script>
@@ -17,8 +17,6 @@
17
17
  <router-view />
18
18
  </div>
19
19
  </section>
20
- <div class="pin right-0 bottom-0 mr-3">
21
- </div>
22
20
  </div>
23
21
  </template>
24
22
 
@@ -1,17 +1,17 @@
1
1
  <template>
2
- <h1 class="h2">Sorry, your password reset has expired</h1>
2
+ <h1 class="h2 h2--small">Sorry, your password reset has expired</h1>
3
3
 
4
- <p class="mt mb-0 color-21">
4
+ <p class="AM-mt-2 AM-mb-0 AM-color-highlight">
5
5
  <strong class="">Email: {{ form?.email }}</strong>
6
6
  </p>
7
- <p class="mt-0.5">
7
+ <p class="AM-mt-0.5">
8
8
  For security, password reset requests are only <strong>active for 1&nbsp;hour</strong>. If you still want to reset your password, please request a new password reset-link.</p>
9
9
 
10
10
  <form class="form"
11
11
  @submit.prevent="submit"
12
12
  >
13
13
  <el-input
14
- class="input--full mt-2 mb-2.5 hidden"
14
+ class="hidden"
15
15
  v-model="form.email"
16
16
  label="Email address"
17
17
  name="email"
@@ -20,17 +20,17 @@
20
20
  placeholder="Email "
21
21
  required
22
22
  />
23
- <button
24
- type="submit"
23
+ <elButton
24
+ type="primary"
25
25
  :disabled="form.processing"
26
26
  :loading="form.processing"
27
- class="button button--primary"
27
+ @click="onSubmit"
28
28
  >
29
29
  Request new reset-link
30
- </button>
30
+ </elButton>
31
31
 
32
- <p class="disclaimer mt-2">
33
- <router-link class="color-1 underline" :to="{ name: `${$store.state.authBase}.login` }">
32
+ <p class="disclaimer AM-mt-3">
33
+ <router-link class="color-1 underline" :to="{ name: `${$store.state.auth.authBase}.login` }">
34
34
  Back to Sign in
35
35
  </router-link>
36
36
  </p>
@@ -39,11 +39,11 @@
39
39
 
40
40
  <script>
41
41
  import Form from "form-backend-validation";
42
- import { default as elInput} from "../../form/basic.vue";
43
42
 
44
43
  export default {
45
44
  components: {
46
- elInput: elInput,
45
+ elInput: require('../../form/basic.vue').default,
46
+ elButton: require('../../basic/Button.vue').default,
47
47
  },
48
48
  data: () => ({
49
49
  form: new Form(
@@ -55,12 +55,12 @@ export default {
55
55
  }),
56
56
 
57
57
  methods: {
58
- async submit() {
58
+ async onSubmit() {
59
59
  try {
60
60
  await this.form.post("/forgot-password");
61
61
 
62
62
  this.$router.push({
63
- name: `${this.$store.state.authBase}.success-forgot`,
63
+ name: `${this.$store.state.auth.authBase}.success-forgot`,
64
64
  query: { email: this.form.email },
65
65
  });
66
66
  } catch (e) {
@@ -1,16 +1,16 @@
1
1
  <template>
2
- <h1 class="h2">Verification link expired</h1>
2
+ <h1 class="h2 h2--small">Verification link expired</h1>
3
3
 
4
4
  <form class="form" @submit.prevent="submit">
5
- <p class="mt mb-0 color-21">
5
+ <p class="AM-mt-2 AM-mb-0 AM-color-highlight">
6
6
  <strong class="">Email: {{ form?.email }}</strong>
7
7
  </p>
8
- <p class="mt-0.5">
8
+ <p class="AM-mt-0.5">
9
9
  This email verification link has expired. Not to worry, we can email you a new one.
10
10
  </p>
11
11
 
12
12
  <el-input
13
- class="mt-2 mb-2.5 hidden"
13
+ class="AM-mt-2 AM-mb-2.5 hidden"
14
14
  v-model="form.email"
15
15
  label="Email address"
16
16
  name="email"
@@ -20,17 +20,17 @@
20
20
  required
21
21
  />
22
22
 
23
- <button
24
- type="submit"
23
+ <elButton
24
+ type="primary"
25
25
  :disabled="form.processing"
26
26
  :loading="form.processing"
27
- class="button button--primary"
27
+ @click="onSubmit"
28
28
  >
29
29
  Re-send verification link
30
- </button>
30
+ </elButton>
31
31
  </form>
32
32
 
33
- <p class="disclaimer mt-2">
33
+ <p class="disclaimer AM-mt-3">
34
34
  Having trouble singing in?
35
35
  <a :href="contact" class="underline">Contact us</a>
36
36
  </p>
@@ -38,11 +38,11 @@
38
38
 
39
39
  <script>
40
40
  import Form from "form-backend-validation";
41
- import { default as elInput} from "../../form/basic.vue";
42
41
 
43
42
  export default {
44
43
  components: {
45
- elInput: elInput,
44
+ elInput: require('../../form/basic.vue').default,
45
+ elButton: require('../../basic/Button.vue').default,
46
46
  },
47
47
  data: () => ({
48
48
  form: new Form(
@@ -56,7 +56,7 @@ export default {
56
56
  }),
57
57
 
58
58
  methods: {
59
- async submit() {
59
+ async onSubmit() {
60
60
  try {
61
61
  if (this.notification) {
62
62
  this.notification.close();
@@ -4,15 +4,15 @@
4
4
  <h1 class="h2">Welcome</h1>
5
5
  <form class="form" @submit.prevent="submit">
6
6
  <div v-if="!form.successful">
7
- <p class="mt mb-0 color-21">
8
- <strong class="">Email: {{ $store.state.user?.email }}</strong>
7
+ <p class="AM-mt-2 AM-mb-0 AM-color-highlight">
8
+ <strong class="">Email: {{ $store.state?.auth?.user?.email }}</strong>
9
9
  </p>
10
- <p class="mt-0.5">
11
- <strong>Hello {{ $store.state.user?.name }}</strong>, and welcome to Policy 360. To maintain security, anyone signing in with a one-time-password must <strong>create a new password</strong> the first time they access the Policy 360 portal.
10
+ <p class="AM-mt-0.5">
11
+ <strong>Hello {{ $store.state?.auth?.user?.name }}</strong>, and welcome to Policy 360. To maintain security, anyone signing in with a one-time-password must <strong>create a new password</strong> the first time they access the Policy 360 portal.
12
12
  </p>
13
13
  <el-input
14
14
  v-model="form.password"
15
- class="mt-2"
15
+ class="AM-mt-2"
16
16
  label="New Password"
17
17
  placeholder="Enter new password"
18
18
  name="password"
@@ -24,23 +24,24 @@
24
24
 
25
25
  <VPasswordValidation :password="form.password" @passwordValid="updatePasswordValidity" />
26
26
 
27
- <button
28
- type="submit"
27
+ <elButton
28
+ class="AM-mt-3"
29
+ type="primary"
29
30
  :disabled="form.processing || !isPasswordValid"
30
31
  :loading="form.processing"
31
- class="button button--primary mt-1.5"
32
+ @click="onSubmit"
32
33
  >
33
34
  <span v-text="'Update password'" />
34
- </button>
35
+ </elButton>
35
36
  </div>
36
37
  <div v-else>
37
38
  <h4 class="mt" v-text="`Success!`" />
38
39
  <strong class="">Email: {{ user?.email }}</strong>
39
40
  <p v-text="`Your password has been updated.`" />
40
- <p class="disclaimer mb-2.5">
41
+ <p class="disclaimer AM-mb-2.5">
41
42
  <router-link
42
43
  class="color-1 underline"
43
- :to="{ name: `${$store.state.authBase}.login` }"
44
+ :to="{ name: `${$store.state.auth.authBase}.login` }"
44
45
  >
45
46
  Continue
46
47
  </router-link>
@@ -53,7 +54,7 @@
53
54
 
54
55
  <script>
55
56
  import Form from "form-backend-validation";
56
- import { default as elInput} from "../../form/basic.vue";
57
+ import store from "../js/AuthStore";
57
58
 
58
59
  export default {
59
60
  data() {
@@ -77,7 +78,7 @@ export default {
77
78
  },
78
79
 
79
80
  methods: {
80
- async submit() {
81
+ async onSubmit() {
81
82
  this.loading = true;
82
83
 
83
84
  try {
@@ -104,7 +105,7 @@ export default {
104
105
 
105
106
  await this.form.post("/login");
106
107
  }
107
- this.$router.push({name: `${this.$store.state.authBase}.callback`,query: {authenticated: true}});
108
+ this.$router.push({name: `${this.$store.state.auth.authBase}.callback`,query: {authenticated: true}});
108
109
 
109
110
  } catch (e) {
110
111
  this.$root.errors(e);
@@ -126,7 +127,8 @@ export default {
126
127
 
127
128
  components: {
128
129
  VPasswordValidation: require("./../components/VPasswordValidation.vue").default,
129
- elInput: elInput,
130
+ elInput: require('../../form/basic.vue').default,
131
+ elButton: require('../../basic/Button.vue').default,
130
132
  },
131
133
  };
132
134
  </script>
@@ -1,15 +1,15 @@
1
1
  <template>
2
2
  <div class="relative">
3
3
  <section id="forgotPasswordForm">
4
- <h1 class="h2">Reset password</h1>
4
+ <h1 class="h2 h2--small">Reset password</h1>
5
5
  <form class="form" @submit.prevent="submit">
6
- <p class="mt-0.5">
6
+ <p class="AM-mt-2">
7
7
  Enter the email address associated with your account to continue.
8
8
  </p>
9
9
 
10
10
  <el-input
11
11
  v-if="!form.successful"
12
- class="mt-2 mb-2.5"
12
+ class="AM-mt-3 AM-mb-3"
13
13
  v-model="form.email"
14
14
  label="Email "
15
15
  placeholder="Enter email address"
@@ -19,19 +19,19 @@
19
19
  required
20
20
  />
21
21
 
22
- <button
23
- type="submit"
22
+ <elButton
23
+ type="primary"
24
24
  :disabled="form.processing || !form.email || form.email?.length < 5"
25
25
  :loading="form.processing"
26
- class="button button--primary"
26
+ @click="onSubmit"
27
27
  >
28
28
  Continue
29
- </button>
29
+ </elButton>
30
30
 
31
- <p class="disclaimer mt-2">
31
+ <p class="disclaimer AM-mt-3">
32
32
  <router-link
33
33
  class="color-1 underline"
34
- :to="{ name: `${$store.state.authBase}.login` }"
34
+ :to="{ name: `${$store.state.auth.authBase}.login` }"
35
35
  >
36
36
  Back to Sign in
37
37
  </router-link>
@@ -43,11 +43,11 @@
43
43
 
44
44
  <script>
45
45
  import Form from "form-backend-validation";
46
- import { default as elInput} from "../../form/basic.vue";
47
46
 
48
47
  export default {
49
48
  components: {
50
- elInput:elInput,
49
+ elInput: require('../../form/basic.vue').default,
50
+ elButton: require('../../basic/Button.vue').default,
51
51
  },
52
52
 
53
53
  data: () => ({
@@ -60,12 +60,12 @@ export default {
60
60
  }),
61
61
 
62
62
  methods: {
63
- async submit() {
63
+ async onSubmit() {
64
64
  try {
65
65
  await this.form.post("/forgot-password");
66
66
 
67
67
  this.$router.push({
68
- name: `${this.$store.state.authBase}.success-forgot`,
68
+ name: `${this.$store.state.auth.authBase}.success-forgot`,
69
69
  query: { email: this.form.email },
70
70
  });
71
71
  } catch (e) {
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <h1 class="h2">Sign in</h1>
3
- <p class="mb-2">Enter your password to continue.</p>
2
+ <h1 class="h2 h2--small">Sign in</h1>
3
+ <p class="AM-mb-3 AM-mt-2">Enter your password to continue.</p>
4
4
 
5
5
  <form @submit.prevent="submit" class="form" id="memberLoginForm">
6
6
  <el-input
7
- class="mb-2.5"
7
+ class="AM-mb-3"
8
8
  label="Email"
9
9
  placeholder="Enter your email address"
10
10
  name="email"
@@ -15,7 +15,7 @@
15
15
  />
16
16
 
17
17
  <el-input
18
- class="mb-2.5"
18
+ class="AM-mb-3"
19
19
  label="Password"
20
20
  placeholder="Enter your password"
21
21
  name="password"
@@ -36,17 +36,17 @@
36
36
  />
37
37
  </div>
38
38
 
39
- <button
40
- type="submit"
39
+ <el-button
40
+ type="primary"
41
41
  :disabled="loading || (form.email?.length < 5 || form.password?.length < 8 )"
42
- class="button button--primary"
42
+ @click="onSubmit"
43
43
  >
44
44
  Continue
45
- </button>
45
+ </el-button>
46
46
 
47
- <p class="disclaimer mt-2">
47
+ <p class="disclaimer AM-mt-3">
48
48
  Having trouble signing in?
49
- <router-link class="color-1 underline" :to="{ name: `${$store.state.authBase}.forgot` }">
49
+ <router-link class="color-1 underline" :to="{ name: `${$store.state.auth.authBase}.forgot` }">
50
50
  Reset password
51
51
  </router-link>
52
52
  or
@@ -57,11 +57,11 @@
57
57
 
58
58
  <script>
59
59
  import Form from "form-backend-validation";
60
- import { default as elInput} from "../../form/basic.vue";
61
60
 
62
61
  export default {
63
62
  components: {
64
- elInput: elInput
63
+ elInput: require('../../form/basic.vue').default,
64
+ elButton: require('../../basic/Button.vue').default,
65
65
  },
66
66
  data() {
67
67
  return {
@@ -80,7 +80,7 @@ export default {
80
80
  },
81
81
 
82
82
  methods: {
83
- async submit() {
83
+ async onSubmit() {
84
84
  if (this.loading) return;
85
85
 
86
86
  this.loading = true;
@@ -1,10 +1,16 @@
1
1
  <template>
2
2
  <!-- Set Spinner -->
3
+ <div class="mx-auto">
4
+ <VLoader class="mx-auto" />
5
+ </div>
3
6
  </template>
4
7
 
5
8
  <script>
6
9
 
7
10
  export default {
11
+ components: {
12
+ VLoader: require("../../layout/Loader.vue").default
13
+ },
8
14
  data() {
9
15
  return {
10
16
 
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <template v-if="stage === 1">
3
- <h1 class="h2">Sign in</h1>
4
- <p class="mb-2">Enter your email address to continue. </p>
3
+ <h1 class="h2 h2--small">Sign in</h1>
4
+ <p class="AM-mb-3 AM-mt-2">Enter your email address to continue. </p>
5
5
 
6
6
  <form @submit.prevent="submit" class="form" id="memberLoginForm">
7
7
  <el-input
8
- class="mb-2.5"
8
+ class="AM-mb-3"
9
9
  label="Email"
10
10
  placeholder="Enter your email address"
11
11
  name="email"
@@ -26,35 +26,36 @@
26
26
  />
27
27
  </div>
28
28
 
29
- <button
30
- type="submit"
29
+ <el-button
30
+ type="primary"
31
31
  :disabled="loading || (form.email?.length < 5 || form.password?.length < 8 )"
32
- class="button button--primary"
32
+ @click="onSubmit"
33
33
  >
34
34
  Continue
35
- </button>
35
+ </el-button>
36
36
 
37
- <p class="disclaimer mt-2">
37
+ <p class="disclaimer AM-mt-3">
38
38
  Having trouble signing in?
39
39
  <a :href="contact" class="underline">Contact us</a>
40
40
  </p>
41
41
  </form>
42
42
  </template>
43
43
  <template v-else>
44
- <h1 class="h2">Sign in with SSO</h1>
45
- <p>Redirecting you to your organisation’s Single Sign-On (SSO) gateway. Please wait a moment.</p>
46
- <p>Redirecting <span class="color-11">in {{ countdown }} seconds...</span></p>
44
+ <h1 class="h2 h2--small">Sign in with SSO</h1>
45
+ <p class="AM-mt-2">Redirecting you to your organisation’s Single Sign-On (SSO) gateway <span class="AM-color-highlight">in {{ countdown }} seconds...</span></p>
46
+ <p class="disclaimer AM-mt-3">
47
+ <a :href="redirect_url" class="underline">Go to SSO gateway</a>
48
+ </p>
47
49
  </template>
48
50
  </template>
49
51
 
50
52
  <script>
51
53
  import Form from "form-backend-validation";
52
54
 
53
- import { default as elInput} from "../../form/basic.vue";
54
-
55
55
  export default {
56
56
  components: {
57
- elInput: elInput,
57
+ elInput: require('../../form/basic.vue').default,
58
+ elButton: require('../../basic/Button.vue').default,
58
59
  },
59
60
  data() {
60
61
  return {
@@ -75,7 +76,7 @@ export default {
75
76
  },
76
77
 
77
78
  methods: {
78
- async submit() {
79
+ async onSubmit() {
79
80
  if (this.loading) return;
80
81
 
81
82
  this.loading = true;
@@ -86,7 +87,7 @@ export default {
86
87
  this.redirect_url = res['redirect_url'];
87
88
  this.setRedirect();
88
89
  } else {
89
- this.$router.push({name: `${this.$store.state.authBase}.logincreds`,query: {email: this.form.email}});
90
+ this.$router.push({name: `${this.$store.state.auth.authBase}.logincreds`,query: {email: this.form.email}});
90
91
  }
91
92
  } catch (e) {
92
93
  this.$root.errors(e);