From 75654b7f19ea9f22be20a4e08991a64f8cbe10d2 Mon Sep 17 00:00:00 2001 From: Anthony Nahas Date: Sat, 20 Apr 2019 21:54:47 +0300 Subject: [PATCH] fix(package): removed unwanted code --- .../mat-password-strength.component.ts | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/module/component/mat-password-strength/mat-password-strength.component.ts b/src/module/component/mat-password-strength/mat-password-strength.component.ts index 8098a11d..ca851acf 100644 --- a/src/module/component/mat-password-strength/mat-password-strength.component.ts +++ b/src/module/component/mat-password-strength/mat-password-strength.component.ts @@ -1,18 +1,10 @@ import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; -import {AbstractControl, FormControl, FormGroup, ValidatorFn, Validators} from '@angular/forms'; +import {FormControl, ValidatorFn, Validators} from '@angular/forms'; import {Criteria} from '../../enum/criteria.enum'; import {Colors} from '../../enum/colors.enum'; import {MatPasswordStrengthValidator} from '../../validator/mat-password-strength-validator'; import {RegExpValidator} from '../../validator/regexp.class'; -/** A hero's name can't match the given regular expression */ -export function forbiddenNameValidator(): ValidatorFn { - return (control: AbstractControl): { [key: string]: any } | null => { - console.log('control -> ', control); - const forbidden = 'nameRe.test(control.value)'; - return forbidden ? {'forbiddenName': {value: control.value}} : null; - }; -} @Component({ selector: 'mat-password-strength', @@ -52,8 +44,6 @@ export class MatPasswordStrengthComponent implements OnInit, OnChanges { containAtLeastOneSpecialChar: boolean; containAtCustomChars: boolean; - formGroup: FormGroup; - // TO ACCESS VIA CONTENT CHILD passwordFormControl: FormControl = new FormControl(); passwordConfirmationFormControl: FormControl = new FormControl(); @@ -68,10 +58,6 @@ export class MatPasswordStrengthComponent implements OnInit, OnChanges { ngOnInit(): void { this.setRulesAndValidators(); - this.formGroup = new FormGroup({ - 'password': this.passwordFormControl, - 'confirmPass': this.passwordConfirmationFormControl, - }, this.checkPasswords); if (this.password) { this.calculatePasswordStrength(); @@ -226,13 +212,6 @@ export class MatPasswordStrengthComponent implements OnInit, OnChanges { ])); } - checkPasswords(group: FormGroup) { // here we have the 'passwords' group - const pass = group.controls.password.value; - const confirmPass = group.controls.confirmPass.value; - - return pass === confirmPass ? null : {notConfirmed: true} - } - reset() { this._strength = 0; this.containAtLeastMinChars =