@structured-id/ui-core 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structured-id/ui-core",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -73,6 +73,7 @@
73
73
  :disable="loading"
74
74
  :label="identifierLabel"
75
75
  :lazy-rules="false"
76
+ :min-username-length="usernameMinLength"
76
77
  @update:principal-type="principalType = $event"
77
78
  />
78
79
 
@@ -102,6 +103,7 @@
102
103
  </q-input>
103
104
 
104
105
  <q-input
106
+ v-if="showConfirmPassword"
105
107
  ref="confirmRef"
106
108
  v-model="confirmPassword"
107
109
  :type="showPassword ? 'text' : 'password'"
@@ -128,7 +130,7 @@
128
130
  :disable="
129
131
  !identifier ||
130
132
  !password ||
131
- !confirmPassword ||
133
+ (showConfirmPassword && !confirmPassword) ||
132
134
  (inviteRequired && !inviteCode)
133
135
  "
134
136
  />
@@ -212,6 +214,11 @@ const props = withDefaults(
212
214
  ) => Promise<void>;
213
215
  /** Min password length (default 12 — NIST SP 800-63B 4th draft baseline). */
214
216
  passwordMinLength?: number;
217
+ /** Show confirm-password field with match validation. Default true. */
218
+ showConfirmPassword?: boolean;
219
+ /** Min username length. Registration default 6 (premium feature gating);
220
+ * login flow can pass 3 since short usernames are valid post-registration. */
221
+ usernameMinLength?: number;
215
222
  }>(),
216
223
  {
217
224
  title: "Create account",
@@ -236,6 +243,8 @@ const props = withDefaults(
236
243
  loginUrl: undefined,
237
244
  inviteRequired: false,
238
245
  initialInviteCode: "",
246
+ showConfirmPassword: true,
247
+ usernameMinLength: 6,
239
248
  },
240
249
  );
241
250
 
@@ -285,7 +294,7 @@ const showInviteField = computed(
285
294
  );
286
295
 
287
296
  async function onSubmit() {
288
- if (password.value !== confirmPassword.value) {
297
+ if (props.showConfirmPassword && password.value !== confirmPassword.value) {
289
298
  error.value = props.passwordsMismatchText;
290
299
  return;
291
300
  }
@@ -294,7 +303,10 @@ async function onSubmit() {
294
303
  error.value = null;
295
304
 
296
305
  try {
297
- const normalized = normalizePrincipal(identifier.value);
306
+ const normalized = normalizePrincipal(
307
+ identifier.value,
308
+ props.usernameMinLength,
309
+ );
298
310
  await props.registerFn(
299
311
  normalized.value,
300
312
  password.value,