@flusys/ng-auth 8.1.4 → 9.0.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.
- package/README.md +11 -0
- package/fesm2022/flusys-ng-auth.mjs +207 -199
- package/fesm2022/flusys-ng-auth.mjs.map +1 -1
- package/package.json +5 -5
- package/types/flusys-ng-auth.d.ts +40 -12
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Service, signal, computed, effect,
|
|
3
|
+
import { inject, Service, signal, computed, effect, InjectionToken, PLATFORM_ID, Component, input, output, untracked, viewChild, DestroyRef, DOCUMENT, Injector, resource, makeStateKey, TransferState } from '@angular/core';
|
|
4
4
|
import { APP_CONFIG, getServiceUrl, isCompanyFeatureEnabled, isServiceEnabled, isSignUpEnabled, getPermissionMode, getDefaultCompanySlug, getDefaultBranchSlug } from '@flusys/ng-core';
|
|
5
5
|
import { of, timeout, switchMap, map, tap, catchError, shareReplay, finalize, BehaviorSubject, throwError, filter, take, from, firstValueFrom, forkJoin } from 'rxjs';
|
|
6
6
|
import { Router, RouterOutlet, ActivatedRoute, RouterLink } from '@angular/router';
|
|
7
|
-
import { PlatformService, PermissionValidatorService, ApiResourceService,
|
|
7
|
+
import { PlatformService, PermissionValidatorService, ApiResourceService, TranslateService, CookieService, USER_PERMISSIONS, COMPANY_PERMISSIONS, BRANCH_PERMISSIONS, SOCIAL_AUTH_CONFIG_PERMISSIONS, resolveTranslationModule, SHARED_MESSAGES, permissionGuard, USER_PROVIDER, COMPANY_API_PROVIDER, USER_PERMISSION_PROVIDER, AUTH_STATE_PROVIDER, RouterTabsComponent, TranslatePipe, HasPermissionDirective, BaseFormComponent, BaseListComponent, BaseListTemplateDirective, FileUrlService, FILE_PROVIDER, PROFILE_PERMISSION_PROVIDER, FileUploaderComponent } from '@flusys/ng-shared';
|
|
8
8
|
import { map as map$1, catchError as catchError$1, tap as tap$1 } from 'rxjs/operators';
|
|
9
9
|
import { isPlatformBrowser, NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
|
|
10
10
|
import { MessageService, CardComponent, CheckboxComponent, FButtonDirective, InputTextDirective, SelectComponent, UiIconComponent, ConfirmationService, DialogComponent, ProgressSpinnerComponent, TooltipDirective, IconFieldComponent, InputIconComponent, TableComponent, TagComponent, PasswordComponent, AvatarComponent, SkeletonComponent, TextareaDirective, ToggleSwitchComponent } from '@flusys/ng-ui';
|
|
@@ -538,6 +538,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
538
538
|
type: Service
|
|
539
539
|
}] });
|
|
540
540
|
|
|
541
|
+
const AUTH_VALIDATION_CONFIG = new InjectionToken('AUTH_VALIDATION_CONFIG');
|
|
542
|
+
const REGISTRATION_FIELD_CONTEXT = new InjectionToken('REGISTRATION_FIELD_CONTEXT');
|
|
543
|
+
const AUTH_REGISTRATION_EXTENSION = new InjectionToken('AUTH_REGISTRATION_EXTENSION');
|
|
544
|
+
const AUTH_USER_LIST_EXTENSION = new InjectionToken('AUTH_USER_LIST_EXTENSION');
|
|
545
|
+
const PROFILE_FIELD_CONTEXT = new InjectionToken('PROFILE_FIELD_CONTEXT');
|
|
546
|
+
const AUTH_PROFILE_EXTENSION = new InjectionToken('AUTH_PROFILE_EXTENSION');
|
|
547
|
+
const USER_FORM_FIELD_CONTEXT = new InjectionToken('USER_FORM_FIELD_CONTEXT');
|
|
548
|
+
const AUTH_USER_FORM_EXTENSION = new InjectionToken('AUTH_USER_FORM_EXTENSION');
|
|
549
|
+
const AUTH_USER_DETAIL_CONFIG = new InjectionToken('AUTH_USER_DETAIL_CONFIG');
|
|
550
|
+
const PASSWORD_SPECIAL_CHAR_PATTERN = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?~`]/;
|
|
551
|
+
const DEFAULT_PASSWORD_VALIDATION = {
|
|
552
|
+
minLength: 8,
|
|
553
|
+
maxLength: 128,
|
|
554
|
+
requireUppercase: true,
|
|
555
|
+
requireLowercase: true,
|
|
556
|
+
requireNumbers: true,
|
|
557
|
+
requireSpecialChars: true,
|
|
558
|
+
};
|
|
559
|
+
function resolvePasswordValidation(config) {
|
|
560
|
+
const overrides = Object.fromEntries(Object.entries(config ?? {}).filter(([, value]) => value !== undefined));
|
|
561
|
+
return { ...DEFAULT_PASSWORD_VALIDATION, ...overrides };
|
|
562
|
+
}
|
|
563
|
+
function validatePassword(password, config = DEFAULT_PASSWORD_VALIDATION) {
|
|
564
|
+
const rules = resolvePasswordValidation(config);
|
|
565
|
+
const fail = (key) => rules.messageKey ?? rules.message ?? key;
|
|
566
|
+
if (password.length < (rules.minLength ?? 0)) {
|
|
567
|
+
return fail('auth.validation.password.min.length');
|
|
568
|
+
}
|
|
569
|
+
if (rules.maxLength && password.length > rules.maxLength) {
|
|
570
|
+
return fail('auth.validation.password.max.length');
|
|
571
|
+
}
|
|
572
|
+
if (rules.pattern) {
|
|
573
|
+
return rules.pattern.test(password) ? null : fail('auth.validation.password.pattern');
|
|
574
|
+
}
|
|
575
|
+
if (rules.requireUppercase && !/[A-Z]/.test(password)) {
|
|
576
|
+
return fail('auth.validation.password.require.uppercase');
|
|
577
|
+
}
|
|
578
|
+
if (rules.requireLowercase && !/[a-z]/.test(password)) {
|
|
579
|
+
return fail('auth.validation.password.require.lowercase');
|
|
580
|
+
}
|
|
581
|
+
if (rules.requireNumbers && !/\d/.test(password)) {
|
|
582
|
+
return fail('auth.validation.password.require.number');
|
|
583
|
+
}
|
|
584
|
+
if (rules.requireSpecialChars && !PASSWORD_SPECIAL_CHAR_PATTERN.test(password)) {
|
|
585
|
+
return fail('auth.validation.password.require.special');
|
|
586
|
+
}
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
function validateEmail(email, config) {
|
|
590
|
+
const pattern = config?.pattern ?? /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
591
|
+
if (pattern.test(email))
|
|
592
|
+
return null;
|
|
593
|
+
return config?.messageKey ?? config?.message ?? 'shared.invalid.email';
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
class PasswordPolicyService {
|
|
597
|
+
config = inject(AUTH_VALIDATION_CONFIG, { optional: true });
|
|
598
|
+
translateAdapter = inject(TranslateService, { optional: true });
|
|
599
|
+
rules = resolvePasswordValidation(this.config?.password);
|
|
600
|
+
minLength = this.rules.minLength ?? DEFAULT_PASSWORD_VALIDATION.minLength;
|
|
601
|
+
maxLength = this.rules.maxLength ?? DEFAULT_PASSWORD_VALIDATION.maxLength;
|
|
602
|
+
validate(password) {
|
|
603
|
+
if (!password)
|
|
604
|
+
return null;
|
|
605
|
+
const key = validatePassword(password, this.rules);
|
|
606
|
+
if (!key)
|
|
607
|
+
return null;
|
|
608
|
+
const params = { min: this.minLength, max: this.maxLength, ...this.rules.messageParam };
|
|
609
|
+
return this.translateAdapter?.translate(key, params) ?? key;
|
|
610
|
+
}
|
|
611
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: PasswordPolicyService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
612
|
+
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.5", ngImport: i0, type: PasswordPolicyService });
|
|
613
|
+
}
|
|
614
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: PasswordPolicyService, decorators: [{
|
|
615
|
+
type: Service
|
|
616
|
+
}] });
|
|
617
|
+
|
|
618
|
+
class EmailPolicyService {
|
|
619
|
+
config = inject(AUTH_VALIDATION_CONFIG, { optional: true })?.email;
|
|
620
|
+
translateAdapter = inject(TranslateService, { optional: true });
|
|
621
|
+
validate(email) {
|
|
622
|
+
if (!email)
|
|
623
|
+
return null;
|
|
624
|
+
const key = validateEmail(email, this.config);
|
|
625
|
+
if (!key)
|
|
626
|
+
return null;
|
|
627
|
+
return this.translateAdapter?.translate(key, this.config?.messageParam) ?? key;
|
|
628
|
+
}
|
|
629
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: EmailPolicyService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
630
|
+
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.5", ngImport: i0, type: EmailPolicyService });
|
|
631
|
+
}
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: EmailPolicyService, decorators: [{
|
|
633
|
+
type: Service
|
|
634
|
+
}] });
|
|
635
|
+
|
|
541
636
|
/**
|
|
542
637
|
* User API Service
|
|
543
638
|
* Signal-based service for user CRUD operations
|
|
@@ -808,6 +903,7 @@ const AUTH_MESSAGES = {
|
|
|
808
903
|
'auth.select.success': 'Company selected successfully',
|
|
809
904
|
'auth.switch.company.success': 'Company switched successfully',
|
|
810
905
|
'auth.register.email.exists': 'Email already exists',
|
|
906
|
+
'auth.register.account.deleted': 'This account has been permanently deleted. Please contact your system administrator.',
|
|
811
907
|
'auth.register.company.already.assigned': 'Company already assigned',
|
|
812
908
|
'auth.password.change.success': 'Password changed successfully',
|
|
813
909
|
'auth.password.change.invalid.current': 'Current password is incorrect',
|
|
@@ -913,10 +1009,10 @@ const AUTH_MESSAGES = {
|
|
|
913
1009
|
'auth.login.branch.label': 'Branch',
|
|
914
1010
|
'auth.login.select.branch.option': 'Select a branch',
|
|
915
1011
|
'auth.login.remember.selection': 'Remember my selection',
|
|
916
|
-
'auth.validation.password.min.length': 'Password must be at least
|
|
1012
|
+
'auth.validation.password.min.length': 'Password must be at least {{min}} characters',
|
|
917
1013
|
'auth.validation.email.required': 'Email is required',
|
|
918
1014
|
'auth.validation.password.required': 'Password is required',
|
|
919
|
-
'auth.validation.password.max.length': 'Password
|
|
1015
|
+
'auth.validation.password.max.length': 'Password must be at most {{max}} characters',
|
|
920
1016
|
'auth.validation.password.pattern': 'Password does not meet requirements',
|
|
921
1017
|
'auth.validation.password.require.uppercase': 'Password must contain at least one uppercase letter',
|
|
922
1018
|
'auth.validation.password.require.lowercase': 'Password must contain at least one lowercase letter',
|
|
@@ -938,6 +1034,7 @@ const AUTH_MESSAGES = {
|
|
|
938
1034
|
// pages/register/register-page.component.ts
|
|
939
1035
|
'auth.register.create.account': 'Create Account',
|
|
940
1036
|
'auth.register.subtitle': 'Fill in your details to create an account.',
|
|
1037
|
+
'auth.register.signup.disabled': 'New account registration is currently disabled.',
|
|
941
1038
|
'auth.register.full.name': 'Full Name',
|
|
942
1039
|
'auth.register.name.placeholder': 'Enter your full name',
|
|
943
1040
|
'auth.phone.label': 'Phone Number',
|
|
@@ -1100,6 +1197,7 @@ const AUTH_MESSAGES = {
|
|
|
1100
1197
|
'auth.social.company.required': 'No account is linked to this {{provider}} profile. Please sign up manually and join or create a company first, then social sign-in will work.',
|
|
1101
1198
|
'auth.social.email.required': '{{provider}} did not share an email address',
|
|
1102
1199
|
'auth.social.email.not.verified': '{{provider}} has not verified this email address',
|
|
1200
|
+
'auth.social.account.deleted': 'This account has been permanently deleted. Please contact your system administrator.',
|
|
1103
1201
|
// components/social-login-buttons.component.ts
|
|
1104
1202
|
'auth.social.continue.with': 'or continue with',
|
|
1105
1203
|
'auth.social.provider.google': 'Google',
|
|
@@ -1627,54 +1725,6 @@ function provideAuthProviders() {
|
|
|
1627
1725
|
];
|
|
1628
1726
|
}
|
|
1629
1727
|
|
|
1630
|
-
const AUTH_VALIDATION_CONFIG = new InjectionToken('AUTH_VALIDATION_CONFIG');
|
|
1631
|
-
const REGISTRATION_FIELD_CONTEXT = new InjectionToken('REGISTRATION_FIELD_CONTEXT');
|
|
1632
|
-
const AUTH_REGISTRATION_EXTENSION = new InjectionToken('AUTH_REGISTRATION_EXTENSION');
|
|
1633
|
-
const AUTH_USER_LIST_EXTENSION = new InjectionToken('AUTH_USER_LIST_EXTENSION');
|
|
1634
|
-
const PROFILE_FIELD_CONTEXT = new InjectionToken('PROFILE_FIELD_CONTEXT');
|
|
1635
|
-
const AUTH_PROFILE_EXTENSION = new InjectionToken('AUTH_PROFILE_EXTENSION');
|
|
1636
|
-
const USER_FORM_FIELD_CONTEXT = new InjectionToken('USER_FORM_FIELD_CONTEXT');
|
|
1637
|
-
const AUTH_USER_FORM_EXTENSION = new InjectionToken('AUTH_USER_FORM_EXTENSION');
|
|
1638
|
-
const AUTH_USER_DETAIL_CONFIG = new InjectionToken('AUTH_USER_DETAIL_CONFIG');
|
|
1639
|
-
function validatePassword(password, config) {
|
|
1640
|
-
const minLen = config.minLength ?? 8;
|
|
1641
|
-
const maxLen = config.maxLength;
|
|
1642
|
-
if (password.length < minLen) {
|
|
1643
|
-
return config.message ?? 'auth.validation.password.min.length';
|
|
1644
|
-
}
|
|
1645
|
-
if (maxLen && password.length > maxLen) {
|
|
1646
|
-
return config.message ?? 'auth.validation.password.max.length';
|
|
1647
|
-
}
|
|
1648
|
-
if (config.pattern) {
|
|
1649
|
-
if (!config.pattern.test(password)) {
|
|
1650
|
-
return config.message ?? 'auth.validation.password.pattern';
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
else {
|
|
1654
|
-
if (config.requireUppercase && !/[A-Z]/.test(password)) {
|
|
1655
|
-
return config.message ?? 'auth.validation.password.require.uppercase';
|
|
1656
|
-
}
|
|
1657
|
-
if (config.requireLowercase && !/[a-z]/.test(password)) {
|
|
1658
|
-
return config.message ?? 'auth.validation.password.require.lowercase';
|
|
1659
|
-
}
|
|
1660
|
-
if (config.requireNumbers && !/\d/.test(password)) {
|
|
1661
|
-
return config.message ?? 'auth.validation.password.require.number';
|
|
1662
|
-
}
|
|
1663
|
-
if (config.requireSpecialChars &&
|
|
1664
|
-
!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password)) {
|
|
1665
|
-
return config.message ?? 'auth.validation.password.require.special';
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
return null;
|
|
1669
|
-
}
|
|
1670
|
-
function validateEmail(email, config) {
|
|
1671
|
-
const pattern = config?.pattern ?? /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1672
|
-
const message = config?.message ?? 'shared.invalid.email';
|
|
1673
|
-
if (!pattern.test(email))
|
|
1674
|
-
return message;
|
|
1675
|
-
return null;
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
1728
|
/**
|
|
1679
1729
|
* Administration Page Component
|
|
1680
1730
|
* Unified administration page with tabs for:
|
|
@@ -4026,9 +4076,7 @@ class LoginPageComponent {
|
|
|
4026
4076
|
translateAdapter = inject(TranslateService, {
|
|
4027
4077
|
optional: true,
|
|
4028
4078
|
});
|
|
4029
|
-
|
|
4030
|
-
optional: true,
|
|
4031
|
-
});
|
|
4079
|
+
emailPolicy = inject(EmailPolicyService);
|
|
4032
4080
|
translate(key, vars) {
|
|
4033
4081
|
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
4034
4082
|
}
|
|
@@ -4050,49 +4098,19 @@ class LoginPageComponent {
|
|
|
4050
4098
|
rememberMe: true,
|
|
4051
4099
|
}, /* @ts-ignore */
|
|
4052
4100
|
...(ngDevMode ? [{ debugName: "loginFormModel" }] : /* istanbul ignore next */ []));
|
|
4053
|
-
emailErrorMessage = computed(() => this.validationConfig?.email?.message ??
|
|
4054
|
-
this.translate('shared.invalid.email'), /* @ts-ignore */
|
|
4055
|
-
...(ngDevMode ? [{ debugName: "emailErrorMessage" }] : /* istanbul ignore next */ []));
|
|
4056
|
-
passwordMinLength = computed(() => this.validationConfig?.password?.minLength ?? 8, /* @ts-ignore */
|
|
4057
|
-
...(ngDevMode ? [{ debugName: "passwordMinLength" }] : /* istanbul ignore next */ []));
|
|
4058
|
-
passwordErrorMessage = computed(() => this.validationConfig?.password?.message ??
|
|
4059
|
-
this.translate('auth.validation.password.min.length', {
|
|
4060
|
-
min: this.passwordMinLength(),
|
|
4061
|
-
}), /* @ts-ignore */
|
|
4062
|
-
...(ngDevMode ? [{ debugName: "passwordErrorMessage" }] : /* istanbul ignore next */ []));
|
|
4063
4101
|
loginForm = form(this.loginFormModel, (f) => {
|
|
4064
4102
|
required(f.email, {
|
|
4065
4103
|
message: this.translate('auth.validation.email.required'),
|
|
4066
4104
|
});
|
|
4067
|
-
email(f.email, { message: this.emailErrorMessage() });
|
|
4068
4105
|
required(f.password, {
|
|
4069
4106
|
message: this.translate('auth.validation.password.required'),
|
|
4070
4107
|
});
|
|
4071
|
-
minLength(f.password, this.passwordMinLength(), {
|
|
4072
|
-
message: this.passwordErrorMessage(),
|
|
4073
|
-
});
|
|
4074
4108
|
});
|
|
4075
|
-
emailValidationError = computed(() =>
|
|
4076
|
-
const email = this.loginFormModel().email;
|
|
4077
|
-
if (!email)
|
|
4078
|
-
return null;
|
|
4079
|
-
return validateEmail(email, this.validationConfig?.email ?? undefined);
|
|
4080
|
-
}, /* @ts-ignore */
|
|
4109
|
+
emailValidationError = computed(() => this.emailPolicy.validate(this.loginFormModel().email), /* @ts-ignore */
|
|
4081
4110
|
...(ngDevMode ? [{ debugName: "emailValidationError" }] : /* istanbul ignore next */ []));
|
|
4082
|
-
passwordValidationError = computed(() => {
|
|
4083
|
-
const password = this.loginFormModel().password;
|
|
4084
|
-
if (!password)
|
|
4085
|
-
return null;
|
|
4086
|
-
if (!this.validationConfig?.password)
|
|
4087
|
-
return null;
|
|
4088
|
-
return validatePassword(password, this.validationConfig.password);
|
|
4089
|
-
}, /* @ts-ignore */
|
|
4090
|
-
...(ngDevMode ? [{ debugName: "passwordValidationError" }] : /* istanbul ignore next */ []));
|
|
4091
4111
|
isLoginFormValid = computed(() => {
|
|
4092
4112
|
const formValid = this.loginForm().valid();
|
|
4093
|
-
|
|
4094
|
-
const passwordError = this.passwordValidationError();
|
|
4095
|
-
return formValid && !emailError && !passwordError;
|
|
4113
|
+
return formValid && !this.emailValidationError();
|
|
4096
4114
|
}, /* @ts-ignore */
|
|
4097
4115
|
...(ngDevMode ? [{ debugName: "isLoginFormValid" }] : /* istanbul ignore next */ []));
|
|
4098
4116
|
selectionFormModel = signal({
|
|
@@ -4196,7 +4214,7 @@ class LoginPageComponent {
|
|
|
4196
4214
|
severity: 'success',
|
|
4197
4215
|
summary: this.translate('shared.success'),
|
|
4198
4216
|
detail: response.messageKey
|
|
4199
|
-
? this.translate(response.messageKey)
|
|
4217
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
4200
4218
|
: (response.message ?? this.translate('auth.login.success')),
|
|
4201
4219
|
});
|
|
4202
4220
|
this.authState.navigateAfterLogin(this.returnUrl());
|
|
@@ -4206,7 +4224,7 @@ class LoginPageComponent {
|
|
|
4206
4224
|
this.isLoading.set(false);
|
|
4207
4225
|
const messageKey = error?.error?.messageKey;
|
|
4208
4226
|
const detail = messageKey
|
|
4209
|
-
? this.translate(messageKey)
|
|
4227
|
+
? this.translate(messageKey, error?.error?.messageVariables)
|
|
4210
4228
|
: error?.error?.message;
|
|
4211
4229
|
this.messageService.add({
|
|
4212
4230
|
severity: 'error',
|
|
@@ -4268,7 +4286,7 @@ class LoginPageComponent {
|
|
|
4268
4286
|
severity: 'success',
|
|
4269
4287
|
summary: this.translate('shared.success'),
|
|
4270
4288
|
detail: response.messageKey
|
|
4271
|
-
? this.translate(response.messageKey)
|
|
4289
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
4272
4290
|
: response.message,
|
|
4273
4291
|
});
|
|
4274
4292
|
this.authState.navigateAfterLogin(this.returnUrl());
|
|
@@ -4305,7 +4323,7 @@ class LoginPageComponent {
|
|
|
4305
4323
|
severity: 'success',
|
|
4306
4324
|
summary: this.translate('shared.success'),
|
|
4307
4325
|
detail: response.messageKey
|
|
4308
|
-
? this.translate(response.messageKey)
|
|
4326
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
4309
4327
|
: response.message,
|
|
4310
4328
|
});
|
|
4311
4329
|
},
|
|
@@ -4427,7 +4445,7 @@ class LoginPageComponent {
|
|
|
4427
4445
|
[formField]="loginForm.email"
|
|
4428
4446
|
autocomplete="email"
|
|
4429
4447
|
/>
|
|
4430
|
-
@if (emailValidationError()
|
|
4448
|
+
@if (emailValidationError()) {
|
|
4431
4449
|
<small class="text-danger block mt-1">{{
|
|
4432
4450
|
emailValidationError()
|
|
4433
4451
|
}}</small>
|
|
@@ -4448,11 +4466,6 @@ class LoginPageComponent {
|
|
|
4448
4466
|
[formField]="loginForm.password"
|
|
4449
4467
|
autocomplete="current-password"
|
|
4450
4468
|
/>
|
|
4451
|
-
@if (passwordValidationError() && loginFormModel().password) {
|
|
4452
|
-
<small class="text-danger block mt-1">{{
|
|
4453
|
-
passwordValidationError()
|
|
4454
|
-
}}</small>
|
|
4455
|
-
}
|
|
4456
4469
|
</div>
|
|
4457
4470
|
|
|
4458
4471
|
<div
|
|
@@ -4717,7 +4730,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
4717
4730
|
[formField]="loginForm.email"
|
|
4718
4731
|
autocomplete="email"
|
|
4719
4732
|
/>
|
|
4720
|
-
@if (emailValidationError()
|
|
4733
|
+
@if (emailValidationError()) {
|
|
4721
4734
|
<small class="text-danger block mt-1">{{
|
|
4722
4735
|
emailValidationError()
|
|
4723
4736
|
}}</small>
|
|
@@ -4738,11 +4751,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
4738
4751
|
[formField]="loginForm.password"
|
|
4739
4752
|
autocomplete="current-password"
|
|
4740
4753
|
/>
|
|
4741
|
-
@if (passwordValidationError() && loginFormModel().password) {
|
|
4742
|
-
<small class="text-danger block mt-1">{{
|
|
4743
|
-
passwordValidationError()
|
|
4744
|
-
}}</small>
|
|
4745
|
-
}
|
|
4746
4754
|
</div>
|
|
4747
4755
|
|
|
4748
4756
|
<div
|
|
@@ -4914,6 +4922,10 @@ var loginPage_component = /*#__PURE__*/Object.freeze({
|
|
|
4914
4922
|
LoginPageComponent: LoginPageComponent
|
|
4915
4923
|
});
|
|
4916
4924
|
|
|
4925
|
+
function sortByOrder(items) {
|
|
4926
|
+
return [...items].sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
4927
|
+
}
|
|
4928
|
+
|
|
4917
4929
|
class ProfilePageComponent {
|
|
4918
4930
|
destroyRef = inject(DestroyRef);
|
|
4919
4931
|
appConfig = inject(APP_CONFIG);
|
|
@@ -4921,6 +4933,7 @@ class ProfilePageComponent {
|
|
|
4921
4933
|
authState = inject(AuthStateService);
|
|
4922
4934
|
userService = inject(UserApiService);
|
|
4923
4935
|
authApiService = inject(AuthApiService);
|
|
4936
|
+
passwordPolicy = inject(PasswordPolicyService);
|
|
4924
4937
|
fileUrlService = inject(FileUrlService);
|
|
4925
4938
|
fileProvider = inject(FILE_PROVIDER, { optional: true });
|
|
4926
4939
|
permissionProvider = inject(PROFILE_PERMISSION_PROVIDER, {
|
|
@@ -4956,22 +4969,19 @@ class ProfilePageComponent {
|
|
|
4956
4969
|
extraSections = computed(() => {
|
|
4957
4970
|
if (!this.profileExtension?.getExtraSections)
|
|
4958
4971
|
return [];
|
|
4959
|
-
|
|
4960
|
-
return sections.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
4972
|
+
return sortByOrder(this.profileExtension.getExtraSections());
|
|
4961
4973
|
}, /* @ts-ignore */
|
|
4962
4974
|
...(ngDevMode ? [{ debugName: "extraSections" }] : /* istanbul ignore next */ []));
|
|
4963
4975
|
editableFields = computed(() => {
|
|
4964
4976
|
if (!this.profileExtension?.getExtraFields)
|
|
4965
4977
|
return [];
|
|
4966
|
-
|
|
4967
|
-
return fields.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
4978
|
+
return sortByOrder(this.profileExtension.getExtraFields());
|
|
4968
4979
|
}, /* @ts-ignore */
|
|
4969
4980
|
...(ngDevMode ? [{ debugName: "editableFields" }] : /* istanbul ignore next */ []));
|
|
4970
4981
|
viewOnlyFields = computed(() => {
|
|
4971
4982
|
if (!this.userFormExtension?.getExtraFields)
|
|
4972
4983
|
return [];
|
|
4973
|
-
|
|
4974
|
-
return fields.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
4984
|
+
return sortByOrder(this.userFormExtension.getExtraFields());
|
|
4975
4985
|
}, /* @ts-ignore */
|
|
4976
4986
|
...(ngDevMode ? [{ debugName: "viewOnlyFields" }] : /* istanbul ignore next */ []));
|
|
4977
4987
|
hasExtraContent = computed(() => this.extraSections().length > 0 ||
|
|
@@ -5115,18 +5125,21 @@ class ProfilePageComponent {
|
|
|
5115
5125
|
...(ngDevMode ? [{ debugName: "passwordModel" }] : /* istanbul ignore next */ []));
|
|
5116
5126
|
passwordForm = form(this.passwordModel, (f) => {
|
|
5117
5127
|
required(f.currentPassword, {
|
|
5118
|
-
message: this.translate('
|
|
5128
|
+
message: this.translate('auth.password.change.current.required'),
|
|
5119
5129
|
});
|
|
5120
5130
|
required(f.newPassword, {
|
|
5121
|
-
message: this.translate('
|
|
5131
|
+
message: this.translate('auth.validation.password.required'),
|
|
5122
5132
|
});
|
|
5123
5133
|
});
|
|
5124
5134
|
isPasswordLoading = signal(false, /* @ts-ignore */
|
|
5125
5135
|
...(ngDevMode ? [{ debugName: "isPasswordLoading" }] : /* istanbul ignore next */ []));
|
|
5136
|
+
newPasswordError = computed(() => this.passwordPolicy.validate(this.passwordModel().newPassword), /* @ts-ignore */
|
|
5137
|
+
...(ngDevMode ? [{ debugName: "newPasswordError" }] : /* istanbul ignore next */ []));
|
|
5126
5138
|
isPasswordFormValid = computed(() => {
|
|
5127
5139
|
const model = this.passwordModel();
|
|
5128
5140
|
return (model.currentPassword.length > 0 &&
|
|
5129
|
-
model.newPassword.length
|
|
5141
|
+
model.newPassword.length > 0 &&
|
|
5142
|
+
!this.newPasswordError() &&
|
|
5130
5143
|
model.newPassword === model.confirmPassword);
|
|
5131
5144
|
}, /* @ts-ignore */
|
|
5132
5145
|
...(ngDevMode ? [{ debugName: "isPasswordFormValid" }] : /* istanbul ignore next */ []));
|
|
@@ -5697,10 +5710,13 @@ class ProfilePageComponent {
|
|
|
5697
5710
|
<f-password
|
|
5698
5711
|
[inputId]="'newPassword'"
|
|
5699
5712
|
[formField]="passwordForm.newPassword"
|
|
5700
|
-
[placeholder]="'shared.min.characters' | translate: { count:
|
|
5713
|
+
[placeholder]="'shared.min.characters' | translate: { count: passwordPolicy.minLength }"
|
|
5701
5714
|
class="w-full"
|
|
5702
5715
|
autocomplete="new-password"
|
|
5703
5716
|
/>
|
|
5717
|
+
@if (newPasswordError()) {
|
|
5718
|
+
<small class="text-danger">{{ newPasswordError() }}</small>
|
|
5719
|
+
}
|
|
5704
5720
|
</div>
|
|
5705
5721
|
|
|
5706
5722
|
<div class="flex flex-col gap-2">
|
|
@@ -6257,10 +6273,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
6257
6273
|
<f-password
|
|
6258
6274
|
[inputId]="'newPassword'"
|
|
6259
6275
|
[formField]="passwordForm.newPassword"
|
|
6260
|
-
[placeholder]="'shared.min.characters' | translate: { count:
|
|
6276
|
+
[placeholder]="'shared.min.characters' | translate: { count: passwordPolicy.minLength }"
|
|
6261
6277
|
class="w-full"
|
|
6262
6278
|
autocomplete="new-password"
|
|
6263
6279
|
/>
|
|
6280
|
+
@if (newPasswordError()) {
|
|
6281
|
+
<small class="text-danger">{{ newPasswordError() }}</small>
|
|
6282
|
+
}
|
|
6264
6283
|
</div>
|
|
6265
6284
|
|
|
6266
6285
|
<div class="flex flex-col gap-2">
|
|
@@ -6466,9 +6485,8 @@ class RegisterPageComponent {
|
|
|
6466
6485
|
authState = inject(AuthStateService);
|
|
6467
6486
|
route = inject(ActivatedRoute);
|
|
6468
6487
|
router = inject(Router);
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
});
|
|
6488
|
+
emailPolicy = inject(EmailPolicyService);
|
|
6489
|
+
passwordPolicy = inject(PasswordPolicyService);
|
|
6472
6490
|
registrationExtension = inject(AUTH_REGISTRATION_EXTENSION, {
|
|
6473
6491
|
optional: true,
|
|
6474
6492
|
});
|
|
@@ -6497,8 +6515,7 @@ class RegisterPageComponent {
|
|
|
6497
6515
|
extraFields = computed(() => {
|
|
6498
6516
|
if (!this.registrationExtension)
|
|
6499
6517
|
return [];
|
|
6500
|
-
|
|
6501
|
-
return fields.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
6518
|
+
return sortByOrder(this.registrationExtension.getExtraFields());
|
|
6502
6519
|
}, /* @ts-ignore */
|
|
6503
6520
|
...(ngDevMode ? [{ debugName: "extraFields" }] : /* istanbul ignore next */ []));
|
|
6504
6521
|
extraFieldsModel = signal(this.extraFields().reduce((acc, field) => {
|
|
@@ -6508,16 +6525,6 @@ class RegisterPageComponent {
|
|
|
6508
6525
|
return acc;
|
|
6509
6526
|
}, {}), /* @ts-ignore */
|
|
6510
6527
|
...(ngDevMode ? [{ debugName: "extraFieldsModel" }] : /* istanbul ignore next */ []));
|
|
6511
|
-
emailErrorMessage = computed(() => this.validationConfig?.email?.message ??
|
|
6512
|
-
this.translate('shared.invalid.email'), /* @ts-ignore */
|
|
6513
|
-
...(ngDevMode ? [{ debugName: "emailErrorMessage" }] : /* istanbul ignore next */ []));
|
|
6514
|
-
passwordMinLength = computed(() => this.validationConfig?.password?.minLength ?? 8, /* @ts-ignore */
|
|
6515
|
-
...(ngDevMode ? [{ debugName: "passwordMinLength" }] : /* istanbul ignore next */ []));
|
|
6516
|
-
passwordErrorMessage = computed(() => this.validationConfig?.password?.message ??
|
|
6517
|
-
this.translate('auth.validation.password.min.length', {
|
|
6518
|
-
min: this.passwordMinLength(),
|
|
6519
|
-
}), /* @ts-ignore */
|
|
6520
|
-
...(ngDevMode ? [{ debugName: "passwordErrorMessage" }] : /* istanbul ignore next */ []));
|
|
6521
6528
|
userFormModel = signal({
|
|
6522
6529
|
name: '',
|
|
6523
6530
|
email: '',
|
|
@@ -6536,13 +6543,9 @@ class RegisterPageComponent {
|
|
|
6536
6543
|
required(f.email, {
|
|
6537
6544
|
message: this.translate('auth.validation.email.required'),
|
|
6538
6545
|
});
|
|
6539
|
-
email(f.email, { message: this.emailErrorMessage() });
|
|
6540
6546
|
required(f.password, {
|
|
6541
6547
|
message: this.translate('auth.validation.password.required'),
|
|
6542
6548
|
});
|
|
6543
|
-
minLength(f.password, this.passwordMinLength(), {
|
|
6544
|
-
message: this.passwordErrorMessage(),
|
|
6545
|
-
});
|
|
6546
6549
|
required(f.confirmPassword, {
|
|
6547
6550
|
message: this.translate('auth.validation.confirm.password.required'),
|
|
6548
6551
|
});
|
|
@@ -6557,21 +6560,9 @@ class RegisterPageComponent {
|
|
|
6557
6560
|
}, /* @ts-ignore */
|
|
6558
6561
|
...(ngDevMode ? [{ debugName: "companyFormModel" }] : /* istanbul ignore next */ []));
|
|
6559
6562
|
companyForm = form(this.companyFormModel);
|
|
6560
|
-
emailValidationError = computed(() =>
|
|
6561
|
-
const email = this.userFormModel().email;
|
|
6562
|
-
if (!email)
|
|
6563
|
-
return null;
|
|
6564
|
-
return validateEmail(email, this.validationConfig?.email ?? undefined);
|
|
6565
|
-
}, /* @ts-ignore */
|
|
6563
|
+
emailValidationError = computed(() => this.emailPolicy.validate(this.userFormModel().email), /* @ts-ignore */
|
|
6566
6564
|
...(ngDevMode ? [{ debugName: "emailValidationError" }] : /* istanbul ignore next */ []));
|
|
6567
|
-
passwordValidationError = computed(() =>
|
|
6568
|
-
const password = this.userFormModel().password;
|
|
6569
|
-
if (!password)
|
|
6570
|
-
return null;
|
|
6571
|
-
if (!this.validationConfig?.password)
|
|
6572
|
-
return null;
|
|
6573
|
-
return validatePassword(password, this.validationConfig.password);
|
|
6574
|
-
}, /* @ts-ignore */
|
|
6565
|
+
passwordValidationError = computed(() => this.passwordPolicy.validate(this.userFormModel().password), /* @ts-ignore */
|
|
6575
6566
|
...(ngDevMode ? [{ debugName: "passwordValidationError" }] : /* istanbul ignore next */ []));
|
|
6576
6567
|
extraFieldsValidationError = computed(() => {
|
|
6577
6568
|
if (!this.registrationExtension?.validateExtraFields)
|
|
@@ -6592,7 +6583,7 @@ class RegisterPageComponent {
|
|
|
6592
6583
|
const userValid = userModel.name.trim().length >= 2 &&
|
|
6593
6584
|
userModel.email.includes('@') &&
|
|
6594
6585
|
!emailError &&
|
|
6595
|
-
userModel.password.length
|
|
6586
|
+
userModel.password.length > 0 &&
|
|
6596
6587
|
!passwordError &&
|
|
6597
6588
|
userModel.confirmPassword.length > 0 &&
|
|
6598
6589
|
this.passwordsMatch() &&
|
|
@@ -6681,9 +6672,8 @@ class RegisterPageComponent {
|
|
|
6681
6672
|
}
|
|
6682
6673
|
});
|
|
6683
6674
|
}
|
|
6684
|
-
onCreateCompanyToggle() {
|
|
6685
|
-
|
|
6686
|
-
if (!currentValue) {
|
|
6675
|
+
onCreateCompanyToggle(createNew) {
|
|
6676
|
+
if (createNew) {
|
|
6687
6677
|
this.companyFormModel.update((model) => ({
|
|
6688
6678
|
...model,
|
|
6689
6679
|
createNewCompany: true,
|
|
@@ -6755,7 +6745,7 @@ class RegisterPageComponent {
|
|
|
6755
6745
|
severity: 'success',
|
|
6756
6746
|
summary: this.translate('shared.success'),
|
|
6757
6747
|
detail: response.messageKey
|
|
6758
|
-
? this.translate(response.messageKey)
|
|
6748
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
6759
6749
|
: response.message,
|
|
6760
6750
|
life: 5000,
|
|
6761
6751
|
});
|
|
@@ -6773,7 +6763,7 @@ class RegisterPageComponent {
|
|
|
6773
6763
|
severity: 'success',
|
|
6774
6764
|
summary: this.translate('shared.success'),
|
|
6775
6765
|
detail: response.messageKey
|
|
6776
|
-
? this.translate(response.messageKey)
|
|
6766
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
6777
6767
|
: response.message,
|
|
6778
6768
|
});
|
|
6779
6769
|
this.authState.navigateAfterLogin(this.returnUrl());
|
|
@@ -6851,7 +6841,7 @@ class RegisterPageComponent {
|
|
|
6851
6841
|
class="w-full"
|
|
6852
6842
|
autocomplete="email"
|
|
6853
6843
|
/>
|
|
6854
|
-
@if (emailValidationError()
|
|
6844
|
+
@if (emailValidationError()) {
|
|
6855
6845
|
<small class="text-danger block mt-1">{{
|
|
6856
6846
|
emailValidationError()
|
|
6857
6847
|
}}</small>
|
|
@@ -6868,12 +6858,12 @@ class RegisterPageComponent {
|
|
|
6868
6858
|
[formField]="userForm.password"
|
|
6869
6859
|
[placeholder]="
|
|
6870
6860
|
'shared.min.characters'
|
|
6871
|
-
| translate: { count:
|
|
6861
|
+
| translate: { count: passwordPolicy.minLength }
|
|
6872
6862
|
"
|
|
6873
6863
|
class="w-full"
|
|
6874
6864
|
autocomplete="new-password"
|
|
6875
6865
|
/>
|
|
6876
|
-
@if (passwordValidationError()
|
|
6866
|
+
@if (passwordValidationError()) {
|
|
6877
6867
|
<small class="text-danger block mt-1">{{
|
|
6878
6868
|
passwordValidationError()
|
|
6879
6869
|
}}</small>
|
|
@@ -7098,7 +7088,7 @@ class RegisterPageComponent {
|
|
|
7098
7088
|
<f-checkbox
|
|
7099
7089
|
[formField]="companyForm.createNewCompany"
|
|
7100
7090
|
[label]="'auth.register.create.new.company' | translate"
|
|
7101
|
-
(
|
|
7091
|
+
(onChange)="onCreateCompanyToggle($event.checked)"
|
|
7102
7092
|
/>
|
|
7103
7093
|
</div>
|
|
7104
7094
|
}
|
|
@@ -7339,7 +7329,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
7339
7329
|
class="w-full"
|
|
7340
7330
|
autocomplete="email"
|
|
7341
7331
|
/>
|
|
7342
|
-
@if (emailValidationError()
|
|
7332
|
+
@if (emailValidationError()) {
|
|
7343
7333
|
<small class="text-danger block mt-1">{{
|
|
7344
7334
|
emailValidationError()
|
|
7345
7335
|
}}</small>
|
|
@@ -7356,12 +7346,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
7356
7346
|
[formField]="userForm.password"
|
|
7357
7347
|
[placeholder]="
|
|
7358
7348
|
'shared.min.characters'
|
|
7359
|
-
| translate: { count:
|
|
7349
|
+
| translate: { count: passwordPolicy.minLength }
|
|
7360
7350
|
"
|
|
7361
7351
|
class="w-full"
|
|
7362
7352
|
autocomplete="new-password"
|
|
7363
7353
|
/>
|
|
7364
|
-
@if (passwordValidationError()
|
|
7354
|
+
@if (passwordValidationError()) {
|
|
7365
7355
|
<small class="text-danger block mt-1">{{
|
|
7366
7356
|
passwordValidationError()
|
|
7367
7357
|
}}</small>
|
|
@@ -7586,7 +7576,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
7586
7576
|
<f-checkbox
|
|
7587
7577
|
[formField]="companyForm.createNewCompany"
|
|
7588
7578
|
[label]="'auth.register.create.new.company' | translate"
|
|
7589
|
-
(
|
|
7579
|
+
(onChange)="onCreateCompanyToggle($event.checked)"
|
|
7590
7580
|
/>
|
|
7591
7581
|
</div>
|
|
7592
7582
|
}
|
|
@@ -7753,6 +7743,7 @@ class ResetPasswordPageComponent {
|
|
|
7753
7743
|
route = inject(ActivatedRoute);
|
|
7754
7744
|
messageService = inject(MessageService);
|
|
7755
7745
|
authApi = inject(AuthApiService);
|
|
7746
|
+
passwordPolicy = inject(PasswordPolicyService);
|
|
7756
7747
|
translateAdapter = inject(TranslateService, {
|
|
7757
7748
|
optional: true,
|
|
7758
7749
|
});
|
|
@@ -7775,11 +7766,6 @@ class ResetPasswordPageComponent {
|
|
|
7775
7766
|
required(f.newPassword, {
|
|
7776
7767
|
message: this.translate('auth.validation.password.required'),
|
|
7777
7768
|
});
|
|
7778
|
-
minLength(f.newPassword, 8, {
|
|
7779
|
-
message: this.translate('auth.validation.password.min.length', {
|
|
7780
|
-
min: 8,
|
|
7781
|
-
}),
|
|
7782
|
-
});
|
|
7783
7769
|
required(f.confirmPassword, {
|
|
7784
7770
|
message: this.translate('auth.validation.confirm.password.required'),
|
|
7785
7771
|
});
|
|
@@ -7790,7 +7776,11 @@ class ResetPasswordPageComponent {
|
|
|
7790
7776
|
model.newPassword !== model.confirmPassword);
|
|
7791
7777
|
}, /* @ts-ignore */
|
|
7792
7778
|
...(ngDevMode ? [{ debugName: "passwordMismatch" }] : /* istanbul ignore next */ []));
|
|
7793
|
-
|
|
7779
|
+
passwordValidationError = computed(() => this.passwordPolicy.validate(this.formModel().newPassword), /* @ts-ignore */
|
|
7780
|
+
...(ngDevMode ? [{ debugName: "passwordValidationError" }] : /* istanbul ignore next */ []));
|
|
7781
|
+
canSubmit = computed(() => this.resetForm().valid() &&
|
|
7782
|
+
!this.passwordValidationError() &&
|
|
7783
|
+
!this.passwordMismatch(), /* @ts-ignore */
|
|
7794
7784
|
...(ngDevMode ? [{ debugName: "canSubmit" }] : /* istanbul ignore next */ []));
|
|
7795
7785
|
constructor() {
|
|
7796
7786
|
effect(() => {
|
|
@@ -7821,13 +7811,12 @@ class ResetPasswordPageComponent {
|
|
|
7821
7811
|
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.isLoading.set(false)))
|
|
7822
7812
|
.subscribe({
|
|
7823
7813
|
next: (response) => {
|
|
7824
|
-
const r = response;
|
|
7825
7814
|
this.messageService.add({
|
|
7826
7815
|
severity: 'success',
|
|
7827
7816
|
summary: this.translate('shared.success'),
|
|
7828
|
-
detail:
|
|
7829
|
-
? this.translate(
|
|
7830
|
-
:
|
|
7817
|
+
detail: response?.messageKey
|
|
7818
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
7819
|
+
: response?.message,
|
|
7831
7820
|
});
|
|
7832
7821
|
this.pageState.set('success');
|
|
7833
7822
|
},
|
|
@@ -7880,15 +7869,22 @@ class ResetPasswordPageComponent {
|
|
|
7880
7869
|
>
|
|
7881
7870
|
{{ 'auth.reset.password.new.password' | translate }}
|
|
7882
7871
|
</label>
|
|
7883
|
-
<
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7872
|
+
<div class="mb-4">
|
|
7873
|
+
<f-password
|
|
7874
|
+
[inputId]="'newPassword'"
|
|
7875
|
+
[placeholder]="
|
|
7876
|
+
'auth.reset.password.new.password.placeholder' | translate
|
|
7877
|
+
"
|
|
7878
|
+
class="w-full"
|
|
7879
|
+
[formField]="resetForm.newPassword"
|
|
7880
|
+
autocomplete="new-password"
|
|
7881
|
+
/>
|
|
7882
|
+
@if (passwordValidationError()) {
|
|
7883
|
+
<small class="text-danger block mt-1">{{
|
|
7884
|
+
passwordValidationError()
|
|
7885
|
+
}}</small>
|
|
7886
|
+
}
|
|
7887
|
+
</div>
|
|
7892
7888
|
|
|
7893
7889
|
<label
|
|
7894
7890
|
for="confirmPassword"
|
|
@@ -8043,15 +8039,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
8043
8039
|
>
|
|
8044
8040
|
{{ 'auth.reset.password.new.password' | translate }}
|
|
8045
8041
|
</label>
|
|
8046
|
-
<
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8042
|
+
<div class="mb-4">
|
|
8043
|
+
<f-password
|
|
8044
|
+
[inputId]="'newPassword'"
|
|
8045
|
+
[placeholder]="
|
|
8046
|
+
'auth.reset.password.new.password.placeholder' | translate
|
|
8047
|
+
"
|
|
8048
|
+
class="w-full"
|
|
8049
|
+
[formField]="resetForm.newPassword"
|
|
8050
|
+
autocomplete="new-password"
|
|
8051
|
+
/>
|
|
8052
|
+
@if (passwordValidationError()) {
|
|
8053
|
+
<small class="text-danger block mt-1">{{
|
|
8054
|
+
passwordValidationError()
|
|
8055
|
+
}}</small>
|
|
8056
|
+
}
|
|
8057
|
+
</div>
|
|
8055
8058
|
|
|
8056
8059
|
<label
|
|
8057
8060
|
for="confirmPassword"
|
|
@@ -8227,7 +8230,7 @@ class SocialCallbackPageComponent {
|
|
|
8227
8230
|
severity: 'success',
|
|
8228
8231
|
summary: this.translate('shared.success'),
|
|
8229
8232
|
detail: response.messageKey
|
|
8230
|
-
? this.translate(response.messageKey)
|
|
8233
|
+
? this.translate(response.messageKey, response.messageVariables)
|
|
8231
8234
|
: (response.message ?? this.translate('auth.login.success')),
|
|
8232
8235
|
});
|
|
8233
8236
|
this.authState.navigateAfterLogin(this.returnUrl());
|
|
@@ -8719,6 +8722,7 @@ class UserFormComponent {
|
|
|
8719
8722
|
userService = inject(UserApiService);
|
|
8720
8723
|
permissionService = inject(UserPermissionApiService);
|
|
8721
8724
|
authState = inject(AuthStateService);
|
|
8725
|
+
passwordPolicy = inject(PasswordPolicyService);
|
|
8722
8726
|
translateAdapter = inject(TranslateService, {
|
|
8723
8727
|
optional: true,
|
|
8724
8728
|
});
|
|
@@ -8772,9 +8776,7 @@ class UserFormComponent {
|
|
|
8772
8776
|
extraFields = computed(() => {
|
|
8773
8777
|
if (!this.userFormExtension?.getExtraFields)
|
|
8774
8778
|
return [];
|
|
8775
|
-
return this.userFormExtension
|
|
8776
|
-
.getExtraFields()
|
|
8777
|
-
.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
8779
|
+
return sortByOrder(this.userFormExtension.getExtraFields());
|
|
8778
8780
|
}, /* @ts-ignore */
|
|
8779
8781
|
...(ngDevMode ? [{ debugName: "extraFields" }] : /* istanbul ignore next */ []));
|
|
8780
8782
|
hasExtraFields = computed(() => this.extraFields().length > 0, /* @ts-ignore */
|
|
@@ -8832,12 +8834,14 @@ class UserFormComponent {
|
|
|
8832
8834
|
});
|
|
8833
8835
|
return injector;
|
|
8834
8836
|
}
|
|
8837
|
+
passwordError = computed(() => this.passwordPolicy.validate(this.formModel().password), /* @ts-ignore */
|
|
8838
|
+
...(ngDevMode ? [{ debugName: "passwordError" }] : /* istanbul ignore next */ []));
|
|
8835
8839
|
isFormValid = computed(() => {
|
|
8836
8840
|
const model = this.formModel();
|
|
8837
8841
|
const isEdit = this.isEditMode();
|
|
8838
8842
|
const nameValid = model.name.trim().length > 0;
|
|
8839
8843
|
const emailValid = model.email.includes('@');
|
|
8840
|
-
const passwordValid =
|
|
8844
|
+
const passwordValid = model.password ? !this.passwordError() : isEdit;
|
|
8841
8845
|
return nameValid && emailValid && passwordValid;
|
|
8842
8846
|
}, /* @ts-ignore */
|
|
8843
8847
|
...(ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []));
|
|
@@ -9080,6 +9084,9 @@ class UserFormComponent {
|
|
|
9080
9084
|
"
|
|
9081
9085
|
autocomplete="new-password"
|
|
9082
9086
|
/>
|
|
9087
|
+
@if (passwordError()) {
|
|
9088
|
+
<small class="text-danger">{{ passwordError() }}</small>
|
|
9089
|
+
}
|
|
9083
9090
|
</div>
|
|
9084
9091
|
|
|
9085
9092
|
<div class="flex flex-col gap-2">
|
|
@@ -9395,6 +9402,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
9395
9402
|
"
|
|
9396
9403
|
autocomplete="new-password"
|
|
9397
9404
|
/>
|
|
9405
|
+
@if (passwordError()) {
|
|
9406
|
+
<small class="text-danger">{{ passwordError() }}</small>
|
|
9407
|
+
}
|
|
9398
9408
|
</div>
|
|
9399
9409
|
|
|
9400
9410
|
<div class="flex flex-col gap-2">
|
|
@@ -10201,15 +10211,13 @@ class UserListComponent {
|
|
|
10201
10211
|
extraColumns = computed(() => {
|
|
10202
10212
|
if (!this.userListExtension)
|
|
10203
10213
|
return [];
|
|
10204
|
-
|
|
10205
|
-
return columns.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
10214
|
+
return sortByOrder(this.userListExtension.getExtraColumns());
|
|
10206
10215
|
}, /* @ts-ignore */
|
|
10207
10216
|
...(ngDevMode ? [{ debugName: "extraColumns" }] : /* istanbul ignore next */ []));
|
|
10208
10217
|
extraActions = computed(() => {
|
|
10209
10218
|
if (!this.userListExtension)
|
|
10210
10219
|
return [];
|
|
10211
|
-
|
|
10212
|
-
return actions.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
10220
|
+
return sortByOrder(this.userListExtension.getExtraActions());
|
|
10213
10221
|
}, /* @ts-ignore */
|
|
10214
10222
|
...(ngDevMode ? [{ debugName: "extraActions" }] : /* istanbul ignore next */ []));
|
|
10215
10223
|
hasUserDetailView = computed(() => !!this.userDetailConfig, /* @ts-ignore */
|
|
@@ -11427,5 +11435,5 @@ var verifyEmailPage_component = /*#__PURE__*/Object.freeze({
|
|
|
11427
11435
|
* Generated bundle index. Do not edit.
|
|
11428
11436
|
*/
|
|
11429
11437
|
|
|
11430
|
-
export { ADMINISTRATION_ROUTES, AUTH_ENDPOINTS, AUTH_MESSAGES, AUTH_PROFILE_EXTENSION, AUTH_REGISTRATION_EXTENSION, AUTH_ROUTES, AUTH_USER_DETAIL_CONFIG, AUTH_USER_FORM_EXTENSION, AUTH_USER_LIST_EXTENSION, AUTH_VALIDATION_CONFIG, AdministrationPageComponent, AuthApiService, AuthCompanyApiProviderAdapter, AuthInitService, AuthLayoutApiAdapter, AuthLayoutStateAdapter, AuthStateProviderAdapter, AuthStateService, AuthUserPermissionProviderAdapter, AuthUserProviderAdapter, BranchApiService, BranchFormComponent, BranchListComponent, BranchPermittedUsersDialogComponent, CompanyApiService, CompanyFormComponent, CompanyListComponent, CompanyPermittedUsersDialogComponent, ForgotPasswordPageComponent, LoginPageComponent, PROFILE_FIELD_CONTEXT, PROFILE_ROUTES, ProfilePageComponent, REGISTRATION_FIELD_CONTEXT, RegisterPageComponent, ResetPasswordPageComponent, SOCIAL_PROVIDERS, SOCIAL_RETURN_URL_KEY, SocialAuthApiService, SocialAuthConfigApiService, SocialCallbackPageComponent, SocialConfigPageComponent, SocialLoginButtonsComponent, SocialProviderEnum, TokenRefreshStateService, USER_FORM_FIELD_CONTEXT, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent, UserFormComponent, UserListComponent, UserPermissionApiService, VerifyEmailPageComponent, authGuard, authInterceptor, companyFeatureGuard, emailFeatureGuard, guestGuard, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, signUpFeatureGuard, tokenRefreshInterceptor, validateEmail, validatePassword };
|
|
11438
|
+
export { ADMINISTRATION_ROUTES, AUTH_ENDPOINTS, AUTH_MESSAGES, AUTH_PROFILE_EXTENSION, AUTH_REGISTRATION_EXTENSION, AUTH_ROUTES, AUTH_USER_DETAIL_CONFIG, AUTH_USER_FORM_EXTENSION, AUTH_USER_LIST_EXTENSION, AUTH_VALIDATION_CONFIG, AdministrationPageComponent, AuthApiService, AuthCompanyApiProviderAdapter, AuthInitService, AuthLayoutApiAdapter, AuthLayoutStateAdapter, AuthStateProviderAdapter, AuthStateService, AuthUserPermissionProviderAdapter, AuthUserProviderAdapter, BranchApiService, BranchFormComponent, BranchListComponent, BranchPermittedUsersDialogComponent, CompanyApiService, CompanyFormComponent, CompanyListComponent, CompanyPermittedUsersDialogComponent, DEFAULT_PASSWORD_VALIDATION, EmailPolicyService, ForgotPasswordPageComponent, LoginPageComponent, PROFILE_FIELD_CONTEXT, PROFILE_ROUTES, PasswordPolicyService, ProfilePageComponent, REGISTRATION_FIELD_CONTEXT, RegisterPageComponent, ResetPasswordPageComponent, SOCIAL_PROVIDERS, SOCIAL_RETURN_URL_KEY, SocialAuthApiService, SocialAuthConfigApiService, SocialCallbackPageComponent, SocialConfigPageComponent, SocialLoginButtonsComponent, SocialProviderEnum, TokenRefreshStateService, USER_FORM_FIELD_CONTEXT, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent, UserFormComponent, UserListComponent, UserPermissionApiService, VerifyEmailPageComponent, authGuard, authInterceptor, companyFeatureGuard, emailFeatureGuard, guestGuard, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, resolvePasswordValidation, signUpFeatureGuard, tokenRefreshInterceptor, validateEmail, validatePassword };
|
|
11431
11439
|
//# sourceMappingURL=flusys-ng-auth.mjs.map
|