diff --git a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.html b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.html index d238955582..69608d6bad 100644 --- a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.html @@ -5,13 +5,13 @@ [validateOnSubmit]="true" class="abp-md-form" > - @if (!hideCurrentPassword) { + @if (!hideCurrentPassword()) {
diff --git a/npm/ng-packs/packages/account/src/lib/components/forgot-password/forgot-password.component.ts b/npm/ng-packs/packages/account/src/lib/components/forgot-password/forgot-password.component.ts index 243cb62f77..d77ecc3b2b 100644 --- a/npm/ng-packs/packages/account/src/lib/components/forgot-password/forgot-password.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/forgot-password/forgot-password.component.ts @@ -1,5 +1,5 @@ import { AccountService } from '@abp/ng.account.core/proxy'; -import { Component, inject, signal } from '@angular/core'; +import { Component, inject, signal, ChangeDetectionStrategy } from '@angular/core'; import { ReactiveFormsModule, UntypedFormBuilder, @@ -13,6 +13,7 @@ import { RouterLink } from '@angular/router'; import { NgxValidateCoreModule } from '@ngx-validate/core'; @Component({ + changeDetection: ChangeDetectionStrategy.OnPush, selector: 'abp-forgot-password', templateUrl: 'forgot-password.component.html', imports: [ @@ -30,8 +31,7 @@ export class ForgotPasswordComponent { form: UntypedFormGroup; readonly inProgress = signal(false); - - isEmailSent = false; + readonly isEmailSent = signal(false); constructor() { this.form = this.fb.group({ @@ -51,7 +51,7 @@ export class ForgotPasswordComponent { }) .pipe(finalize(() => this.inProgress.set(false))) .subscribe(() => { - this.isEmailSent = true; + this.isEmailSent.set(true); }); } } diff --git a/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts b/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts index 2fb90f55cd..c85d766367 100644 --- a/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts @@ -1,4 +1,4 @@ -import { Component, Injector, OnInit, inject, signal } from '@angular/core'; +import { Component, Injector, OnInit, inject, signal, ChangeDetectionStrategy } from '@angular/core'; import { ReactiveFormsModule, UntypedFormBuilder, @@ -22,6 +22,7 @@ import { getRedirectUrl } from '../../utils'; const { maxLength, required } = Validators; @Component({ + changeDetection: ChangeDetectionStrategy.OnPush, selector: 'abp-login', templateUrl: './login.component.html', imports: [ diff --git a/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html b/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html index 91167b0ede..1ca3e1e457 100644 --- a/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html @@ -1,51 +1,65 @@
-{{ 'AbpAccount::ResetPassword_Information' | abpLocalization }}
+{{ 'AbpAccount::YourPasswordIsSuccessfullyReset' | abpLocalization }} diff --git a/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts b/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts index 97d7776140..25879ac653 100644 --- a/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts @@ -1,6 +1,14 @@ import { AccountService } from '@abp/ng.account.core/proxy'; import { ButtonComponent, getPasswordValidators } from '@abp/ng.theme.shared'; -import { Component, Injector, OnInit, inject, signal } from '@angular/core'; +import { + Component, + effect, + Injector, + inject, + signal, + ChangeDetectionStrategy, +} from '@angular/core'; +import { toSignal } from '@angular/core/rxjs-interop'; import { ReactiveFormsModule, UntypedFormBuilder, @@ -15,6 +23,7 @@ import { LocalizationPipe } from '@abp/ng.core'; const PASSWORD_FIELDS = ['password', 'confirmPassword']; @Component({ + changeDetection: ChangeDetectionStrategy.OnPush, selector: 'abp-reset-password', templateUrl: './reset-password.component.html', imports: [ @@ -25,18 +34,19 @@ const PASSWORD_FIELDS = ['password', 'confirmPassword']; ButtonComponent, ], }) -export class ResetPasswordComponent implements OnInit { +export class ResetPasswordComponent { private fb = inject(UntypedFormBuilder); private accountService = inject(AccountService); private route = inject(ActivatedRoute); private router = inject(Router); private injector = inject(Injector); + private readonly queryParams = toSignal(this.route.queryParams); + form!: UntypedFormGroup; readonly inProgress = signal(false); - - isPasswordReset = false; + readonly isPasswordReset = signal(false); mapErrorsFn: Validation.MapErrorsFn = (errors, groupErrors, control) => { if (PASSWORD_FIELDS.indexOf(String(control?.name)) < 0) return errors; @@ -44,9 +54,16 @@ export class ResetPasswordComponent implements OnInit { return errors.concat(groupErrors.filter(({ key }) => key === 'passwordMismatch')); }; - ngOnInit(): void { - this.route.queryParams.subscribe(({ userId, resetToken }) => { - if (!userId || !resetToken) this.router.navigateByUrl('/account/login'); + constructor() { + effect(() => { + const params = this.queryParams(); + if (!params) return; + + const { userId, resetToken } = params; + if (!userId || !resetToken) { + void this.router.navigateByUrl('/account/login'); + return; + } this.form = this.fb.group( { @@ -75,7 +92,7 @@ export class ResetPasswordComponent implements OnInit { }) .pipe(finalize(() => this.inProgress.set(false))) .subscribe(() => { - this.isPasswordReset = true; + this.isPasswordReset.set(true); }); } }