From 97197be4d57793d9463c08cb4b4ab94df525c75a Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 17 Aug 2020 13:42:03 +0300 Subject: [PATCH] refactor: set hideCurrentPassword false when the password changed --- .../change-password/change-password.component.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts index be281c0cb9..84e87f7ce7 100644 --- a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts @@ -1,7 +1,7 @@ import { ChangePassword, ProfileState } from '@abp/ng.core'; import { getPasswordValidators, ToasterService } from '@abp/ng.theme.shared'; import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; import { comparePasswords, Validation } from '@ngx-validate/core'; import { Store } from '@ngxs/store'; import { finalize } from 'rxjs/operators'; @@ -80,17 +80,18 @@ export class ChangePasswordComponent .subscribe({ next: () => { this.form.reset(); - this.toasterService.success('AbpAccount::PasswordChangedMessage', 'Success', { + this.toasterService.success('AbpAccount::PasswordChangedMessage', '', { life: 5000, }); + + if (this.hideCurrentPassword) { + this.hideCurrentPassword = false; + this.form.addControl('password', new FormControl('', [required])); + } }, error: err => { this.toasterService.error( snq(() => err.error.error.message, 'AbpAccount::DefaultErrorMessage'), - 'Error', - { - life: 7000, - }, ); }, });