diff --git a/ui-ngx/src/app/core/auth/auth.service.ts b/ui-ngx/src/app/core/auth/auth.service.ts index f8ffd5e8b6..a70a8baa47 100644 --- a/ui-ngx/src/app/core/auth/auth.service.ts +++ b/ui-ngx/src/app/core/auth/auth.service.ts @@ -164,8 +164,8 @@ export class AuthService { )); } - public getUserPasswordPolicy() { - return this.http.get(`/api/noauth/userPasswordPolicy`, defaultHttpOptions()); + public getUserPasswordPolicy(config?: RequestConfig) { + return this.http.get(`/api/noauth/userPasswordPolicy`, defaultHttpOptionsFromConfig(config)); } public activateByEmailCode(emailCode: string): Observable { diff --git a/ui-ngx/src/app/modules/login/login-routing.module.ts b/ui-ngx/src/app/modules/login/login-routing.module.ts index da4ac05def..3608f425a9 100644 --- a/ui-ngx/src/app/modules/login/login-routing.module.ts +++ b/ui-ngx/src/app/modules/login/login-routing.module.ts @@ -34,7 +34,7 @@ const passwordPolicyResolver: ResolveFn = (route: ActivatedR state: RouterStateSnapshot, router = inject(Router), authService = inject(AuthService)) => { - return authService.getUserPasswordPolicy().pipe( + return authService.getUserPasswordPolicy({ignoreErrors: true}).pipe( catchError(() => { return of({} as UserPasswordPolicy); }) diff --git a/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts index 6e3dcc0f63..417df10b18 100644 --- a/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts @@ -19,7 +19,6 @@ import { AuthService } from '@core/auth/auth.service'; import { PageComponent } from '@shared/components/page.component'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { UserPasswordPolicy } from '@shared/models/settings.models'; import { passwordsMatchValidator, @@ -44,10 +43,7 @@ export class CreatePasswordComponent extends PageComponent { super(); this.activateToken = this.route.snapshot.queryParams['activateToken'] || ''; - - this.route.data - .pipe(takeUntilDestroyed()) - .subscribe((data) => this.passwordPolicy = data['passwordPolicy']); + this.passwordPolicy = this.route.snapshot.data['passwordPolicy']; this.buildCreatePasswordForm(); } diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts index bfc8986625..7305acb4e6 100644 --- a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts @@ -20,7 +20,6 @@ import { PageComponent } from '@shared/components/page.component'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { UserPasswordPolicy } from '@shared/models/settings.models'; -import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { passwordsMatchValidator, passwordStrengthValidator @@ -47,13 +46,8 @@ export class ResetPasswordComponent extends PageComponent { super(); this.resetToken = this.route.snapshot.queryParams['resetToken'] || ''; - - this.route.data - .pipe(takeUntilDestroyed()) - .subscribe((data) => { - this.passwordPolicy = data['passwordPolicy']; - this.isExpiredPassword = data['expiredPassword'] ?? false; - }); + this.passwordPolicy = this.route.snapshot.data['passwordPolicy']; + this.isExpiredPassword = this.route.snapshot.data['expiredPassword'] ?? false; this.buildResetPasswordForm(); } diff --git a/ui-ngx/src/app/shared/components/password-requirements-tooltip.component.ts b/ui-ngx/src/app/shared/components/password-requirements-tooltip.component.ts index e279708184..1e2f97dfa7 100644 --- a/ui-ngx/src/app/shared/components/password-requirements-tooltip.component.ts +++ b/ui-ngx/src/app/shared/components/password-requirements-tooltip.component.ts @@ -19,6 +19,7 @@ import { CdkOverlayOrigin, ConnectionPositionPair } from '@angular/cdk/overlay'; import { passwordErrorRules } from '@shared/models/password.models'; import { AbstractControl } from '@angular/forms'; import { UserPasswordPolicy } from '@shared/models/settings.models'; +import { POSITION_MAP } from '@shared/models/overlay.models'; @Component({ selector: 'tb-password-requirements-tooltip', @@ -35,13 +36,7 @@ export class PasswordRequirementsTooltipComponent { isTooltipOpen = false; overlayPositions: ConnectionPositionPair[] = [ - { - originX: 'center', - originY: 'top', - overlayX: 'center', - overlayY: 'bottom', - offsetY: -20 - } + {...POSITION_MAP.top, offsetY: -20} ]; checkForError(errorName: string): boolean {