checkbox is avoid ambiguous
This commit is contained in:
parent
70b4f97f2c
commit
e843578df9
|
@ -68,7 +68,7 @@
|
||||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
||||||
<label for="ambiguous">{{'ambiguous' | i18n}}</label>
|
<label for="ambiguous">{{'ambiguous' | i18n}}</label>
|
||||||
<input id="ambiguous" type="checkbox" (change)="saveOptions()"
|
<input id="ambiguous" type="checkbox" (change)="saveOptions()"
|
||||||
[(ngModel)]="options.ambiguous">
|
[(ngModel)]="avoidAmbiguous">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,12 +25,14 @@ export class PasswordGeneratorComponent implements OnInit {
|
||||||
options: any = {};
|
options: any = {};
|
||||||
password: string = '-';
|
password: string = '-';
|
||||||
showOptions = false;
|
showOptions = false;
|
||||||
|
avoidAmbiguous = false;
|
||||||
|
|
||||||
constructor(private passwordGenerationService: PasswordGenerationService, private analytics: Angulartics2,
|
constructor(private passwordGenerationService: PasswordGenerationService, private analytics: Angulartics2,
|
||||||
private utilsService: UtilsService) { }
|
private utilsService: UtilsService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.options = await this.passwordGenerationService.getOptions();
|
this.options = await this.passwordGenerationService.getOptions();
|
||||||
|
this.avoidAmbiguous = !this.options.ambiguous;
|
||||||
this.password = this.passwordGenerationService.generatePassword(this.options);
|
this.password = this.passwordGenerationService.generatePassword(this.options);
|
||||||
this.analytics.eventTrack.next({ action: 'Generated Password' });
|
this.analytics.eventTrack.next({ action: 'Generated Password' });
|
||||||
await this.passwordGenerationService.addHistory(this.password);
|
await this.passwordGenerationService.addHistory(this.password);
|
||||||
|
@ -86,6 +88,7 @@ export class PasswordGeneratorComponent implements OnInit {
|
||||||
private normalizeOptions() {
|
private normalizeOptions() {
|
||||||
this.options.minLowercase = 0;
|
this.options.minLowercase = 0;
|
||||||
this.options.minUppercase = 0;
|
this.options.minUppercase = 0;
|
||||||
|
this.options.ambiguous = !this.avoidAmbiguous;
|
||||||
|
|
||||||
if (!this.options.uppercase && !this.options.lowercase && !this.options.number && !this.options.special) {
|
if (!this.options.uppercase && !this.options.lowercase && !this.options.number && !this.options.special) {
|
||||||
this.options.lowercase = true;
|
this.options.lowercase = true;
|
||||||
|
|
Loading…
Reference in New Issue