@isoftdata/svelte-user-configuration 1.2.4 → 1.2.6

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.
@@ -16,7 +16,7 @@ let passwordRecoveryEmail = void 0;
16
16
  let passwordIsValid = false;
17
17
  export let validationRules = void 0;
18
18
  export let changePasswordMode = false;
19
- export let confirmPasswordSet = void 0;
19
+ export let confirmPasswordSet;
20
20
  export async function open(userAccount) {
21
21
  currentPassword = "";
22
22
  newPassword = "";
@@ -50,17 +50,9 @@ $: disablePasswordChange = changePasswordMode && !currentPassword || passwordMis
50
50
  id="setPasswordForm"
51
51
  on:submit={async e => {
52
52
  e.preventDefault()
53
- if (!disablePasswordChange && confirmPasswordSet) {
54
- try {
55
- const success = await confirmPasswordSet({ currentPassword, newPassword })
56
- if (success) {
57
- show = false
58
- }
59
- } catch (err) {
60
- //In case the consumer doesn't handle their own error messages
61
- console.error(err)
62
- err instanceof Error ? alert(err.message) : undefined
63
- }
53
+ if (!disablePasswordChange) {
54
+ await confirmPasswordSet({ currentPassword, newPassword })
55
+ show = false
64
56
  }
65
57
  }}
66
58
  >
@@ -4,10 +4,10 @@ declare const __propDef: {
4
4
  props: {
5
5
  validationRules?: PasswordValidationRules | undefined;
6
6
  changePasswordMode?: boolean;
7
- confirmPasswordSet?: ((ctx: {
7
+ confirmPasswordSet: (ctx: {
8
8
  currentPassword: string;
9
9
  newPassword: string;
10
- }) => boolean | Promise<boolean>) | undefined;
10
+ }) => void | Promise<void>;
11
11
  open?: (userAccount?: UserAccount) => Promise<void>;
12
12
  };
13
13
  events: {
@@ -317,14 +317,16 @@ $: isCreatingNewUser = userAccount.id === null;
317
317
  try {
318
318
  await confirmPasswordSet({ currentPassword, newPassword })
319
319
  await success?.({
320
- heading: translate('configuration.user.passwordChangeSuccess', 'Password Changed!'),
321
- message: translate('configuration.user.passwordChangeSuccess', 'Password changed successfully'),
320
+ heading: translate('configuration.user.passwordChangeSuccessHeading', 'Password Changed!'),
321
+ message: translate('configuration.user.passwordChangeSuccessMessage', 'Password changed successfully'),
322
322
  })
323
323
  } catch (err) {
324
324
  await error?.({
325
- heading: translate('configuration.user.passwordChangeFailure', 'Failed To Change Password'),
325
+ heading: translate('configuration.user.passwordChangeErrorHeading', 'Failed To Change Password'),
326
326
  message: err instanceof Error ? err.message : translate('workOrder.unknownError', 'An unknown error occurred'),
327
327
  })
328
+ console.error(err)
329
+ throw err
328
330
  }
329
331
  } else {
330
332
  //Guess if they didn't give us a confirmPasswordSet function to call we'll just update the userAccount object and they can handle it later
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/svelte-user-configuration",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",