|
|
@ -1,5 +1,5 @@ |
|
|
import { ABP, ConfigState } from '@abp/ng.core'; |
|
|
import { ABP } from '@abp/ng.core'; |
|
|
import { ConfirmationService, Confirmation } from '@abp/ng.theme.shared'; |
|
|
import { Confirmation, ConfirmationService, getPasswordValidators } from '@abp/ng.theme.shared'; |
|
|
import { Component, OnInit, TemplateRef, TrackByFunction, ViewChild } from '@angular/core'; |
|
|
import { Component, OnInit, TemplateRef, TrackByFunction, ViewChild } from '@angular/core'; |
|
|
import { |
|
|
import { |
|
|
AbstractControl, |
|
|
AbstractControl, |
|
|
@ -9,7 +9,6 @@ import { |
|
|
FormGroup, |
|
|
FormGroup, |
|
|
Validators, |
|
|
Validators, |
|
|
} from '@angular/forms'; |
|
|
} from '@angular/forms'; |
|
|
import { PasswordRules, validatePassword } from '@ngx-validate/core'; |
|
|
|
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { finalize, pluck, switchMap, take } from 'rxjs/operators'; |
|
|
import { finalize, pluck, switchMap, take } from 'rxjs/operators'; |
|
|
@ -23,8 +22,8 @@ import { |
|
|
UpdateUser, |
|
|
UpdateUser, |
|
|
} from '../../actions/identity.actions'; |
|
|
} from '../../actions/identity.actions'; |
|
|
import { Identity } from '../../models/identity'; |
|
|
import { Identity } from '../../models/identity'; |
|
|
import { IdentityState } from '../../states/identity.state'; |
|
|
|
|
|
import { IdentityService } from '../../services/identity.service'; |
|
|
import { IdentityService } from '../../services/identity.service'; |
|
|
|
|
|
import { IdentityState } from '../../states/identity.state'; |
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'abp-users', |
|
|
selector: 'abp-users', |
|
|
templateUrl: './users.component.html', |
|
|
templateUrl: './users.component.html', |
|
|
@ -63,10 +62,6 @@ export class UsersComponent implements OnInit { |
|
|
|
|
|
|
|
|
sortKey = ''; |
|
|
sortKey = ''; |
|
|
|
|
|
|
|
|
passwordRulesArr = [] as PasswordRules; |
|
|
|
|
|
|
|
|
|
|
|
requiredPasswordLength = 1; |
|
|
|
|
|
|
|
|
|
|
|
trackByFn: TrackByFunction<AbstractControl> = (index, item) => Object.keys(item)[0] || index; |
|
|
trackByFn: TrackByFunction<AbstractControl> = (index, item) => Object.keys(item)[0] || index; |
|
|
|
|
|
|
|
|
onVisiblePermissionChange = event => { |
|
|
onVisiblePermissionChange = event => { |
|
|
@ -86,32 +81,6 @@ export class UsersComponent implements OnInit { |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
this.get(); |
|
|
this.get(); |
|
|
|
|
|
|
|
|
const passwordRules: ABP.Dictionary<string> = this.store.selectSnapshot( |
|
|
|
|
|
ConfigState.getSettings('Identity.Password'), |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ((passwordRules['Abp.Identity.Password.RequireDigit'] || '').toLowerCase() === 'true') { |
|
|
|
|
|
this.passwordRulesArr.push('number'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((passwordRules['Abp.Identity.Password.RequireLowercase'] || '').toLowerCase() === 'true') { |
|
|
|
|
|
this.passwordRulesArr.push('small'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((passwordRules['Abp.Identity.Password.RequireUppercase'] || '').toLowerCase() === 'true') { |
|
|
|
|
|
this.passwordRulesArr.push('capital'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
(passwordRules['Abp.Identity.Password.RequireNonAlphanumeric'] || '').toLowerCase() === 'true' |
|
|
|
|
|
) { |
|
|
|
|
|
this.passwordRulesArr.push('special'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (Number.isInteger(+passwordRules['Abp.Identity.Password.RequiredLength'])) { |
|
|
|
|
|
this.requiredPasswordLength = +passwordRules['Abp.Identity.Password.RequiredLength']; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onSearch(value: string) { |
|
|
onSearch(value: string) { |
|
|
@ -146,11 +115,7 @@ export class UsersComponent implements OnInit { |
|
|
), |
|
|
), |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const passwordValidators = [ |
|
|
const passwordValidators = getPasswordValidators(this.store); |
|
|
validatePassword(this.passwordRulesArr), |
|
|
|
|
|
Validators.minLength(this.requiredPasswordLength), |
|
|
|
|
|
Validators.maxLength(128), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
this.form.addControl('password', new FormControl('', [...passwordValidators])); |
|
|
this.form.addControl('password', new FormControl('', [...passwordValidators])); |
|
|
|
|
|
|
|
|
|