@isoftdata/svelte-user-configuration 1.2.4 → 1.2.5
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
|
|
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
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
7
|
+
confirmPasswordSet: (ctx: {
|
|
8
8
|
currentPassword: string;
|
|
9
9
|
newPassword: string;
|
|
10
|
-
}) =>
|
|
10
|
+
}) => void | Promise<void>;
|
|
11
11
|
open?: (userAccount?: UserAccount) => Promise<void>;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
@@ -325,6 +325,8 @@ $: isCreatingNewUser = userAccount.id === null;
|
|
|
325
325
|
heading: translate('configuration.user.passwordChangeFailure', '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
|