@isoftdata/svelte-user-configuration 1.1.3 → 1.2.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.
package/README.md CHANGED
@@ -21,6 +21,8 @@ npm i @isoftdata/svelte-user-configuration
21
21
  | `hasPermissionToChangePassword` | boolean | ❌ | `false` | Whether the user has permission to change passwords. |
22
22
  | `myAccountMode` | boolean | ❌ | `false` | When `true`, admin controls will be hidden/disabled. This is designed to be used when using the user account info component standalone so the current session user can edit their own account info, including first & last name, password recovery email, & password. |
23
23
 
24
+ > Additionally, the `validationRules` & `passwordIsValid` props from the [PasswordFields](<https://github.com/ISoft-Data-Systems/svelte-component-password-fields>) component can be passed and will be used during password setting when `hasPermissionToChangePassword` or `myAccountMode` are `true` .
25
+
24
26
  ### Site Access Properties
25
27
 
26
28
  | Prop | Type | Required | Default | Description |
@@ -12,6 +12,8 @@ let lastResetDate = void 0;
12
12
  let input = void 0;
13
13
  let passwordRecoveryEmail = void 0;
14
14
  let error = void 0;
15
+ let passwordIsValid = false;
16
+ export let validationRules = void 0;
15
17
  export let confirmPasswordSet = void 0;
16
18
  export async function open(userAccount) {
17
19
  error = void 0;
@@ -32,7 +34,7 @@ const { t: translate } = getContext("i18next") || { t: defaultTranslate };
32
34
  title={translate('configuration.user.accountInfo.setPasswordModal.header', 'Set Password')}
33
35
  confirmButtonText={translate('configuration.user.accountInfo.passwordManagementModal.setPassword', 'Set Password')}
34
36
  confirmButtonIcon="check"
35
- confirmButtonDisabled={passwordMismatch || !newPassword || !confirmPassword}
37
+ confirmButtonDisabled={passwordMismatch || !newPassword || !confirmPassword || !passwordIsValid}
36
38
  on:close={() => (show = false)}
37
39
  confirmButtonType="submit"
38
40
  confirmButtonFormId="setPasswordForm"
@@ -66,7 +68,9 @@ const { t: translate } = getContext("i18next") || { t: defaultTranslate };
66
68
  bind:confirmPassword
67
69
  bind:passwordMismatch
68
70
  bind:passwordInput={input}
71
+ bind:passwordIsValid
69
72
  columnClass="col-12"
73
+ {validationRules}
70
74
  passwordLabel={translate('configuration.user.accountInfo.passwordManagementModal.newPassword', 'New Password')}
71
75
  confirmPasswordLabel={translate('configuration.user.accountInfo.passwordManagementModal.confirmNewPassword', 'Confirm New Password')}
72
76
  />
@@ -1,7 +1,8 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { UserAccount } from './';
2
+ import type { UserAccount, PasswordValidationRules } from './';
3
3
  declare const __propDef: {
4
4
  props: {
5
+ validationRules?: PasswordValidationRules | undefined;
5
6
  confirmPasswordSet?: ((ctx: {
6
7
  password: string;
7
8
  }) => void | Promise<void>) | undefined;
@@ -30,6 +30,7 @@ export let passwordValidationRules = void 0;
30
30
  export let cardTitle = translate("configuration.user.accountInfoHeader", "Account");
31
31
  export let showPasswordChange = false;
32
32
  export let passwordMismatch = false;
33
+ export let passwordIsValid = false;
33
34
  let isLoading = false;
34
35
  let passwordSetModal;
35
36
  let deactivateUserModal;
@@ -76,6 +77,7 @@ $: workEmail = userAccount.workEmail;
76
77
  $: status = userAccount.status;
77
78
  $: activationPIN = userAccount.userActivationData?.activationPIN;
78
79
  $: isCreatingNewUser = userAccount.id === null;
80
+ $: passwordMismatch = !(userAccount.currentPassword && userAccount.newPassword && confirmPassword && userAccount.newPassword === confirmPassword);
79
81
  </script>
80
82
 
81
83
  <div
@@ -311,7 +313,7 @@ $: isCreatingNewUser = userAccount.id === null;
311
313
  <PasswordFields
312
314
  bind:password={userAccount.newPassword}
313
315
  bind:confirmPassword
314
- bind:passwordMismatch
316
+ bind:passwordIsValid
315
317
  columnClass="col-12"
316
318
  passwordLabel={translate('configuration.user.accountInfo.passwordManagementModal.newPassword', 'New Password')}
317
319
  confirmPasswordLabel={translate('configuration.user.accountInfo.passwordManagementModal.confirmNewPassword', 'Confirm New Password')}
@@ -357,4 +359,5 @@ $: isCreatingNewUser = userAccount.id === null;
357
359
  confirmPasswordSet?.({ password })
358
360
  }
359
361
  }}
362
+ validationRules={passwordValidationRules}
360
363
  />
@@ -30,6 +30,7 @@ declare const __propDef: {
30
30
  cardTitle?: string;
31
31
  showPasswordChange?: boolean;
32
32
  passwordMismatch?: boolean;
33
+ passwordIsValid?: boolean;
33
34
  };
34
35
  events: {
35
36
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/svelte-user-configuration",
3
- "version": "1.1.3",
3
+ "version": "1.2.1",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",