@fishawack/lab-velocity 1.3.1 → 1.4.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.
@@ -12,7 +12,6 @@
12
12
  @close="close"
13
13
  />
14
14
  </div>
15
- <button class="button button--modal" @click="open = false"></button>
16
15
  </div>
17
16
 
18
17
  </div>
@@ -91,7 +90,7 @@ export default {
91
90
  async handler(forcePasswordChange) {
92
91
  if(forcePasswordChange) {
93
92
  this.compName = this.validComponents["force-reset"];
94
- this.open = comp;
93
+ this.open = true;
95
94
  }
96
95
  }
97
96
  }
@@ -100,6 +99,12 @@ export default {
100
99
  components: {
101
100
  VForceReset: require("../routes/force-reset.vue").default,
102
101
  VPasswordChange: require("../routes/change-password.vue").default,
102
+ },
103
+ mounted() {
104
+ if(this.$store.state.auth.forcePasswordChange) {
105
+ this.compName = this.validComponents["force-reset"];
106
+ this.open = true;
107
+ }
103
108
  }
104
109
  };
105
110
  </script>
@@ -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,19 +131,19 @@ 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
 
130
138
  if (to.query.verified) {
131
139
  next({ name: `${authBase}.success-verify` });
132
140
  } else if (authenticated) {
133
- if(forcePasswordChange) {
134
- next(false);
135
- }
136
141
  if (admin && !user?.admin) {
137
142
  next({ name: redirect });
138
143
  } else if (to.name === "login" || to.name === `${authBase}.login`) {
144
+ if(autoLogin) {
145
+ next({ name: `${authBase}.force-login` });
146
+ }
139
147
  next({ name: redirect });
140
148
  } else if (
141
149
  !user?.email_verified_at &&
@@ -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 ?? false,
13
14
  }
14
15
  },
15
16
 
@@ -17,6 +17,7 @@
17
17
  required
18
18
  v-model="form.current_password"
19
19
  :error="form.errors"
20
+ :password="true"
20
21
  />
21
22
  <el-input
22
23
  v-model="form.password"
@@ -28,6 +29,7 @@
28
29
  type="password"
29
30
  autocomplete="new-password"
30
31
  required
32
+ :password="true"
31
33
  />
32
34
 
33
35
  <VPasswordValidation :password="form.password" @passwordValid="updatePasswordValidity" />
@@ -125,6 +127,7 @@ export default {
125
127
  this.$root.errors(e);
126
128
  } finally {
127
129
  this.loading = false;
130
+ this.postLogin();
128
131
  }
129
132
  },
130
133
 
@@ -133,7 +136,15 @@ export default {
133
136
  },
134
137
  handleButton() {
135
138
  this.$emit('close');
136
- }
139
+ },
140
+
141
+ async postLogin() {
142
+ this.$store.commit("setAuth", true);
143
+
144
+ const { data: user } = await this.$store.dispatch("getUser", {
145
+ errors: this.$root.errors,
146
+ });
147
+ },
137
148
  },
138
149
 
139
150
  metaInfo() {
@@ -107,8 +107,17 @@ export default {
107
107
  this.$root.errors(e);
108
108
  } finally {
109
109
  this.loading = false;
110
+ await this.postLogin();
110
111
  }
111
112
  },
113
+
114
+ async postLogin() {
115
+ this.$store.commit("setAuth", true);
116
+
117
+ const { data: user } = await this.$store.dispatch("getUser", {
118
+ errors: this.$root.errors,
119
+ });
120
+ },
112
121
 
113
122
  updatePasswordValidity(isValid) {
114
123
  this.isPasswordValid = isValid;
@@ -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>
@@ -19,4 +19,34 @@
19
19
  &__error {
20
20
  color: $colorAlert;
21
21
  }
22
+ }
23
+
24
+ .form__icon-container {
25
+ position: absolute;
26
+ top: 50%;
27
+ right: 12px;
28
+ transform: translateY(-50%);
29
+ display: flex;
30
+
31
+ .icon {
32
+ display: flex;
33
+ }
34
+ }
35
+
36
+ .input--password {
37
+ .el-input-group__append {
38
+ border: none;
39
+ box-shadow: none;
40
+ background-color: transparent;
41
+ position: absolute;
42
+ right: 0px;
43
+ top: 0px;
44
+ padding: 0px;
45
+ }
46
+ .icon {
47
+ width: 24px;
48
+ min-width: 24px;
49
+ padding-bottom: 24px;
50
+ fill: #cfd8dd !important
51
+ }
22
52
  }
package/form/basic.vue CHANGED
@@ -6,13 +6,13 @@
6
6
 
7
7
  <el-input
8
8
  v-bind="{ ...$attrs, class: undefined }"
9
- :class="[`${baseClass}__textbox`]"
9
+ :class="[`${baseClass}__textbox`, type=== 'password' ? 'input--password': '']"
10
10
  :name="name"
11
11
  :id="name"
12
12
  :disabled="disabled"
13
13
  :minlength="minlength"
14
14
  :maxlength="maxlength"
15
- :type="type"
15
+ :type="type === 'password' && visibility ? 'text' : type"
16
16
  :placeholder="placeholder"
17
17
  v-model="content"
18
18
  :required="required"
@@ -24,8 +24,13 @@
24
24
  <template v-if="prepend" #prepend>
25
25
  <slot name="prepend" />
26
26
  </template>
27
- <template v-if="append" #append>
27
+ <template v-if="append || type === 'password'" #append>
28
28
  <slot name="append" />
29
+
30
+ <div v-if="type === 'password'" class="form__icon-container">
31
+ <GSvg name="icon-error" class="form__error-icon icon" embed artboard v-if="error && error.first(name)" />
32
+ <GSvg :name="visibility ? 'icon-visibility' : 'icon-visibility-off'" class="form__action-icon icon pointer" embed artboard @click="visibility = !visibility" />
33
+ </div>
29
34
  </template>
30
35
  </el-input>
31
36
  </XInput>
@@ -67,7 +72,12 @@ export default {
67
72
  formatter: {
68
73
  type: Function,
69
74
  default: null,
70
- },
75
+ }
76
+ },
77
+ data() {
78
+ return {
79
+ visibility: false
80
+ }
71
81
  },
72
82
 
73
83
  components: {
@@ -1,4 +1,5 @@
1
1
  @import "../components/button";
2
+ @import "../components/basic";
2
3
  @import "./modal";
3
4
 
4
5
  // AuthModule
@@ -98,17 +99,17 @@
98
99
  }
99
100
  }
100
101
  }
101
- &__icon-container{
102
- position: absolute;
103
- top: 50%;
104
- right: $spacing * 1.5;
105
- transform: translateY(-50%);
106
- display: flex;
107
- }
108
- &__action-icon {
109
- margin-left: $spacing * 0.5;
110
- cursor: pointer;
111
- }
102
+ // &__icon-container{
103
+ // position: absolute;
104
+ // top: 50%;
105
+ // right: $spacing * 1.5;
106
+ // transform: translateY(-50%);
107
+ // display: flex;
108
+ // }
109
+ // &__action-icon {
110
+ // margin-left: $spacing * 0.5;
111
+ // cursor: pointer;
112
+ // }
112
113
  }
113
114
  .vel-basic__label {
114
115
  font-size: 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",