Browse Source

refactor: set hideCurrentPassword false when the password changed

pull/5086/head
mehmet-erim 6 years ago
parent
commit
97197be4d5
  1. 13
      npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts

13
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,
},
);
},
});

Loading…
Cancel
Save