@fishawack/lab-velocity 2.0.0-beta.39 → 2.0.0-beta.40

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.
@@ -81,6 +81,10 @@ export default [
81
81
  key: "roles",
82
82
  initial: ({ model }) =>
83
83
  model?.roles.map((val) => val.id) || [],
84
+ preparation: ({ form }) =>
85
+ form.roles?.map((d) =>
86
+ typeof d === "object" ? d.value : d,
87
+ ),
84
88
  render: {
85
89
  read: ({ model }) =>
86
90
  h(
@@ -24,41 +24,50 @@
24
24
 
25
25
  <hr class="my-3 hr-muted" />
26
26
 
27
- <VelCheckbox
28
- v-model="form.notify_user"
29
- name="notify_user"
30
- :error="form.errors"
31
- label="Send email to notify user of account and password"
32
- />
33
- <VelCheckbox
34
- v-model="form.force_password_change"
35
- name="force_password_change"
36
- :error="form.errors"
37
- label="Force password change on first login"
38
- />
39
- <VelCheckbox
40
- v-model="form.set_password"
41
- name="set_password"
42
- :error="form.errors"
43
- label="Auto generate password"
44
- />
45
- <template v-if="!form.set_password">
46
- <VelBasic
47
- v-model="form.password"
48
- name="password"
27
+ <template v-if="isSSOCompany">
28
+ <p class="mb-3">
29
+ This user belongs to an SSO-enabled company. They
30
+ will authenticate via SSO on first login. No
31
+ password is required.
32
+ </p>
33
+ </template>
34
+ <template v-else>
35
+ <VelCheckbox
36
+ v-model="form.notify_user"
37
+ name="notify_user"
38
+ :error="form.errors"
39
+ label="Send email to notify user of account and password"
40
+ />
41
+ <VelCheckbox
42
+ v-model="form.force_password_change"
43
+ name="force_password_change"
49
44
  :error="form.errors"
50
- type="password"
51
- placeholder="Password"
52
- label="Password"
45
+ label="Force password change on first login"
53
46
  />
54
- <VelBasic
55
- v-model="form.password_confirmation"
56
- name="password_confirmation"
47
+ <VelCheckbox
48
+ v-model="form.set_password"
49
+ name="set_password"
57
50
  :error="form.errors"
58
- type="password"
59
- placeholder="Password Confirmation"
60
- label="Password Confirmation"
51
+ label="Auto generate password"
61
52
  />
53
+ <template v-if="!form.set_password">
54
+ <VelBasic
55
+ v-model="form.password"
56
+ name="password"
57
+ :error="form.errors"
58
+ type="password"
59
+ placeholder="Password"
60
+ label="Password"
61
+ />
62
+ <VelBasic
63
+ v-model="form.password_confirmation"
64
+ name="password_confirmation"
65
+ :error="form.errors"
66
+ type="password"
67
+ placeholder="Password Confirmation"
68
+ label="Password Confirmation"
69
+ />
70
+ </template>
62
71
  </template>
63
72
 
64
73
  <hr class="my-5 hr-muted" />
@@ -141,6 +150,9 @@ export default {
141
150
  domain() {
142
151
  return this.form.email?.split("@")[1];
143
152
  },
153
+ isSSOCompany() {
154
+ return !!this.company?.sso_enabled;
155
+ },
144
156
  },
145
157
 
146
158
  watch: {
@@ -54,7 +54,9 @@ export default [
54
54
  form.populate(resource.form.preparation(props));
55
55
 
56
56
  if (method === "post") {
57
- if (form.set_password) {
57
+ const isSSOCompany = props.$refs?.form?.isSSOCompany;
58
+
59
+ if (!isSSOCompany && form.set_password) {
58
60
  const password = generatePassword();
59
61
  form.password = password;
60
62
  form.password_confirmation = password;
@@ -62,7 +64,11 @@ export default [
62
64
 
63
65
  let res = await form.post(`/api/users`);
64
66
 
65
- if (form.set_password && !form.notify_user) {
67
+ if (
68
+ !isSSOCompany &&
69
+ form.set_password &&
70
+ !form.notify_user
71
+ ) {
66
72
  ElMessageBox.alert(
67
73
  `<p>The password below will not be shown again. Ensure you've taken a copy if you plan to send manually. <br><br><strong>Email</strong>: ${form.email}<br> <strong>Password</strong>: ${form.password}</p>`,
68
74
  "User Created",
@@ -81,8 +87,9 @@ export default [
81
87
  } else {
82
88
  ElNotification({
83
89
  title: "Success",
84
- message:
85
- "User created a notified of their new account",
90
+ message: isSSOCompany
91
+ ? "SSO user pre-provisioned successfully"
92
+ : "User created a notified of their new account",
86
93
  type: "success",
87
94
  });
88
95
 
@@ -193,6 +200,26 @@ export default [
193
200
  : { array: model.roles },
194
201
  ),
195
202
  },
203
+ {
204
+ key: "verified",
205
+ label: "Verified",
206
+ render: ({ model }) =>
207
+ h(
208
+ "span",
209
+ {
210
+ title: model.email_verified_at
211
+ ? `Verified: ${new Date(model.email_verified_at).toLocaleString()}`
212
+ : "Not verified",
213
+ style: {
214
+ color: model.email_verified_at
215
+ ? "green"
216
+ : "red",
217
+ fontSize: "18px",
218
+ },
219
+ },
220
+ model.email_verified_at ? "✓" : "✗",
221
+ ),
222
+ },
196
223
  ],
197
224
  },
198
225
  description: {
@@ -221,6 +248,20 @@ export default [
221
248
  text: model.company.name,
222
249
  }),
223
250
  },
251
+ {
252
+ key: "email_verified_at",
253
+ label: "Email Verified",
254
+ render: ({ model }) =>
255
+ h(
256
+ "span",
257
+ {},
258
+ model.email_verified_at
259
+ ? new Date(
260
+ model.email_verified_at,
261
+ ).toLocaleString()
262
+ : "Not verified",
263
+ ),
264
+ },
224
265
  ],
225
266
  },
226
267
  index: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.39",
3
+ "version": "2.0.0-beta.40",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",