@isoftdata/svelte-user-configuration 1.2.5 → 1.3.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.
|
@@ -26,6 +26,8 @@ export let cardHeight = 0;
|
|
|
26
26
|
export let myAccountMode = false;
|
|
27
27
|
export let passwordValidationRules = void 0;
|
|
28
28
|
export let cardTitle = translate("configuration.user.accountInfoHeader", "Account");
|
|
29
|
+
export let recoveryEmailIsValid = true;
|
|
30
|
+
export let workEmailIsValid = true;
|
|
29
31
|
let isLoading = false;
|
|
30
32
|
let passwordSetModal;
|
|
31
33
|
let deactivateUserModal;
|
|
@@ -66,10 +68,14 @@ async function reactivateUserAccount() {
|
|
|
66
68
|
await accountInfoChanged?.();
|
|
67
69
|
}
|
|
68
70
|
}
|
|
71
|
+
const emailAddressRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
72
|
+
const emailIsValid = (emailAddress) => emailAddressRegex.test(emailAddress);
|
|
69
73
|
$: workEmail = userAccount.workEmail;
|
|
70
74
|
$: status = userAccount.status;
|
|
71
75
|
$: activationPIN = userAccount.userActivationData?.activationPIN;
|
|
72
76
|
$: isCreatingNewUser = userAccount.id === null;
|
|
77
|
+
$: recoveryEmailIsValid = myAccountMode && userAccount.recoveryEmail ? emailIsValid(userAccount.recoveryEmail) : true;
|
|
78
|
+
$: workEmailIsValid = !myAccountMode && userAccount.workEmail ? emailIsValid(userAccount.workEmail) : true;
|
|
73
79
|
</script>
|
|
74
80
|
|
|
75
81
|
<div
|
|
@@ -203,6 +209,8 @@ $: isCreatingNewUser = userAccount.id === null;
|
|
|
203
209
|
inputmode="email"
|
|
204
210
|
readonly={myAccountMode || undefined}
|
|
205
211
|
tabindex={myAccountMode ? -1 : undefined}
|
|
212
|
+
hint={!workEmailIsValid ? translate('common:invalidEmailAddress', 'Invalid Email') : undefined}
|
|
213
|
+
hintClass="text-danger"
|
|
206
214
|
/>
|
|
207
215
|
{#if workEmail && !isCreatingNewUser && status === 'PENDING_ACTIVATION'}
|
|
208
216
|
<Button
|
|
@@ -224,6 +232,8 @@ $: isCreatingNewUser = userAccount.id === null;
|
|
|
224
232
|
inputmode="email"
|
|
225
233
|
readonly={!myAccountMode || undefined}
|
|
226
234
|
tabindex={!myAccountMode ? -1 : undefined}
|
|
235
|
+
hint={!recoveryEmailIsValid ? translate('common:invalidEmailAddress', 'Invalid Email') : undefined}
|
|
236
|
+
hintClass="text-danger"
|
|
227
237
|
/>
|
|
228
238
|
</div>
|
|
229
239
|
{#if !isCreatingNewUser && !myAccountMode}
|
|
@@ -317,12 +327,12 @@ $: isCreatingNewUser = userAccount.id === null;
|
|
|
317
327
|
try {
|
|
318
328
|
await confirmPasswordSet({ currentPassword, newPassword })
|
|
319
329
|
await success?.({
|
|
320
|
-
heading: translate('configuration.user.
|
|
321
|
-
message: translate('configuration.user.
|
|
330
|
+
heading: translate('configuration.user.passwordChangeSuccessHeading', 'Password Changed!'),
|
|
331
|
+
message: translate('configuration.user.passwordChangeSuccessMessage', 'Password changed successfully'),
|
|
322
332
|
})
|
|
323
333
|
} catch (err) {
|
|
324
334
|
await error?.({
|
|
325
|
-
heading: translate('configuration.user.
|
|
335
|
+
heading: translate('configuration.user.passwordChangeErrorHeading', 'Failed To Change Password'),
|
|
326
336
|
message: err instanceof Error ? err.message : translate('workOrder.unknownError', 'An unknown error occurred'),
|
|
327
337
|
})
|
|
328
338
|
console.error(err)
|
|
@@ -28,6 +28,8 @@ declare const __propDef: {
|
|
|
28
28
|
myAccountMode?: boolean;
|
|
29
29
|
passwordValidationRules?: PasswordValidationRules | undefined;
|
|
30
30
|
cardTitle?: string;
|
|
31
|
+
recoveryEmailIsValid?: boolean;
|
|
32
|
+
workEmailIsValid?: boolean;
|
|
31
33
|
};
|
|
32
34
|
events: {
|
|
33
35
|
[evt: string]: CustomEvent<any>;
|