Skip to content

Commit 75654b7

Browse files
committed
fix(package): removed unwanted code
1 parent c4a87fe commit 75654b7

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

src/module/component/mat-password-strength/mat-password-strength.component.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
2-
import {AbstractControl, FormControl, FormGroup, ValidatorFn, Validators} from '@angular/forms';
2+
import {FormControl, ValidatorFn, Validators} from '@angular/forms';
33
import {Criteria} from '../../enum/criteria.enum';
44
import {Colors} from '../../enum/colors.enum';
55
import {MatPasswordStrengthValidator} from '../../validator/mat-password-strength-validator';
66
import {RegExpValidator} from '../../validator/regexp.class';
77

8-
/** A hero's name can't match the given regular expression */
9-
export function forbiddenNameValidator(): ValidatorFn {
10-
return (control: AbstractControl): { [key: string]: any } | null => {
11-
console.log('control -> ', control);
12-
const forbidden = 'nameRe.test(control.value)';
13-
return forbidden ? {'forbiddenName': {value: control.value}} : null;
14-
};
15-
}
168

179
@Component({
1810
selector: 'mat-password-strength',
@@ -52,8 +44,6 @@ export class MatPasswordStrengthComponent implements OnInit, OnChanges {
5244
containAtLeastOneSpecialChar: boolean;
5345
containAtCustomChars: boolean;
5446

55-
formGroup: FormGroup;
56-
5747
// TO ACCESS VIA CONTENT CHILD
5848
passwordFormControl: FormControl = new FormControl();
5949
passwordConfirmationFormControl: FormControl = new FormControl();
@@ -68,10 +58,6 @@ export class MatPasswordStrengthComponent implements OnInit, OnChanges {
6858

6959
ngOnInit(): void {
7060
this.setRulesAndValidators();
71-
this.formGroup = new FormGroup({
72-
'password': this.passwordFormControl,
73-
'confirmPass': this.passwordConfirmationFormControl,
74-
}, this.checkPasswords);
7561

7662
if (this.password) {
7763
this.calculatePasswordStrength();
@@ -226,13 +212,6 @@ export class MatPasswordStrengthComponent implements OnInit, OnChanges {
226212
]));
227213
}
228214

229-
checkPasswords(group: FormGroup) { // here we have the 'passwords' group
230-
const pass = group.controls.password.value;
231-
const confirmPass = group.controls.confirmPass.value;
232-
233-
return pass === confirmPass ? null : {notConfirmed: true}
234-
}
235-
236215
reset() {
237216
this._strength = 0;
238217
this.containAtLeastMinChars =

0 commit comments

Comments
 (0)