@isoftdata/svelte-user-configuration 1.2.6 → 1.3.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.
|
@@ -32,7 +32,7 @@ export async function open(userAccount) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
const { t: translate } = getContext("i18next") || { t: defaultTranslate };
|
|
35
|
-
$: passwordMismatch = !(
|
|
35
|
+
$: passwordMismatch = !(newPassword && confirmPassword && newPassword === confirmPassword);
|
|
36
36
|
$: disablePasswordChange = changePasswordMode && !currentPassword || passwordMismatch || !newPassword || !confirmPassword || !passwordIsValid;
|
|
37
37
|
</script>
|
|
38
38
|
|
|
@@ -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}
|
|
@@ -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>;
|