1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-29 12:55:21 +01:00

Bump jslib and add compatability with username generation (#1450)

Co-authored-by: Hinton <oscar@oscarhinton.com>
This commit is contained in:
Kyle Spearrin 2022-03-25 05:56:34 -04:00 committed by GitHub
parent ad6308eb48
commit 21167301f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 39 deletions

2
jslib

@ -1 +1 @@
Subproject commit 5070a783a7730bcf7a0e4bf726c2e41d1b41cf2d Subproject commit fa73c13b8c9ed35cbb9909e342b143fa8a57f1a0

View File

@ -7,7 +7,7 @@
<div class="modal-dialog modal-sm" role="document"> <div class="modal-dialog modal-sm" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
<app-callout type="info" *ngIf="enforcedPolicyOptions?.inEffect()"> <app-callout type="info" *ngIf="enforcedPasswordPolicyOptions?.inEffect()">
{{ "passwordGeneratorPolicyInEffect" | i18n }} {{ "passwordGeneratorPolicyInEffect" | i18n }}
</app-callout> </app-callout>
<div class="password-block"> <div class="password-block">
@ -48,12 +48,12 @@
<input <input
type="radio" type="radio"
class="radio" class="radio"
[(ngModel)]="options.type" [(ngModel)]="passwordOptions.type"
name="Type_{{ o.value }}" name="Type_{{ o.value }}"
id="type_{{ o.value }}" id="type_{{ o.value }}"
[value]="o.value" [value]="o.value"
(change)="saveOptions()" (change)="savePasswordOptions()"
[checked]="options.type === o.value" [checked]="passwordOptions.type === o.value"
/> />
<label class="unstyled" for="type_{{ o.value }}"> <label class="unstyled" for="type_{{ o.value }}">
{{ o.name }} {{ o.name }}
@ -62,7 +62,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="box" [hidden]="!showOptions" *ngIf="options.type === 'passphrase'"> <div class="box" [hidden]="!showOptions" *ngIf="passwordOptions.type === 'passphrase'">
<div class="box-content condensed"> <div class="box-content condensed">
<div class="box-content-row box-content-row-input" appBoxRow> <div class="box-content-row box-content-row-input" appBoxRow>
<label for="num-words">{{ "numWords" | i18n }}</label> <label for="num-words">{{ "numWords" | i18n }}</label>
@ -71,8 +71,8 @@
type="number" type="number"
min="3" min="3"
max="20" max="20"
(blur)="saveOptions()" (blur)="savePasswordOptions()"
[(ngModel)]="options.numWords" [(ngModel)]="passwordOptions.numWords"
/> />
</div> </div>
<div class="box-content-row box-content-row-input" appBoxRow> <div class="box-content-row box-content-row-input" appBoxRow>
@ -81,8 +81,8 @@
id="word-separator" id="word-separator"
type="text" type="text"
maxlength="1" maxlength="1"
(input)="saveOptions()" (input)="savePasswordOptions()"
[(ngModel)]="options.wordSeparator" [(ngModel)]="passwordOptions.wordSeparator"
/> />
</div> </div>
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>
@ -90,9 +90,9 @@
<input <input
id="capitalize" id="capitalize"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[(ngModel)]="options.capitalize" [(ngModel)]="passwordOptions.capitalize"
[disabled]="enforcedPolicyOptions?.capitalize" [disabled]="enforcedPasswordPolicyOptions?.capitalize"
/> />
</div> </div>
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>
@ -100,14 +100,14 @@
<input <input
id="include-number" id="include-number"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[(ngModel)]="options.includeNumber" [(ngModel)]="passwordOptions.includeNumber"
[disabled]="enforcedPolicyOptions?.includeNumber" [disabled]="enforcedPasswordPolicyOptions?.includeNumber"
/> />
</div> </div>
</div> </div>
</div> </div>
<ng-container *ngIf="options.type === 'password'"> <ng-container *ngIf="passwordOptions.type === 'password'">
<div class="box" [hidden]="!showOptions"> <div class="box" [hidden]="!showOptions">
<div class="box-content condensed"> <div class="box-content condensed">
<div class="box-content-row box-content-row-slider" appBoxRow> <div class="box-content-row box-content-row-slider" appBoxRow>
@ -117,8 +117,8 @@
type="number" type="number"
min="5" min="5"
max="128" max="128"
[(ngModel)]="options.length" [(ngModel)]="passwordOptions.length"
(blur)="saveOptions()" (blur)="savePasswordOptions()"
/> />
<input <input
id="lengthRange" id="lengthRange"
@ -126,7 +126,7 @@
min="5" min="5"
max="128" max="128"
step="1" step="1"
[(ngModel)]="options.length" [(ngModel)]="passwordOptions.length"
(change)="sliderChanged()" (change)="sliderChanged()"
(input)="sliderInput()" (input)="sliderInput()"
/> />
@ -136,9 +136,9 @@
<input <input
id="uppercase" id="uppercase"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[disabled]="enforcedPolicyOptions?.useUppercase" [disabled]="enforcedPasswordPolicyOptions?.useUppercase"
[(ngModel)]="options.uppercase" [(ngModel)]="passwordOptions.uppercase"
/> />
</div> </div>
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>
@ -146,9 +146,9 @@
<input <input
id="lowercase" id="lowercase"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[disabled]="enforcedPolicyOptions?.useLowercase" [disabled]="enforcedPasswordPolicyOptions?.useLowercase"
[(ngModel)]="options.lowercase" [(ngModel)]="passwordOptions.lowercase"
/> />
</div> </div>
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>
@ -156,9 +156,9 @@
<input <input
id="numbers" id="numbers"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[disabled]="enforcedPolicyOptions?.useNumbers" [disabled]="enforcedPasswordPolicyOptions?.useNumbers"
[(ngModel)]="options.number" [(ngModel)]="passwordOptions.number"
/> />
</div> </div>
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>
@ -166,9 +166,9 @@
<input <input
id="special" id="special"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[disabled]="enforcedPolicyOptions?.useSpecial" [disabled]="enforcedPasswordPolicyOptions?.useSpecial"
[(ngModel)]="options.special" [(ngModel)]="passwordOptions.special"
/> />
</div> </div>
</div> </div>
@ -182,8 +182,8 @@
type="number" type="number"
min="0" min="0"
max="9" max="9"
(blur)="saveOptions()" (blur)="savePasswordOptions()"
[(ngModel)]="options.minNumber" [(ngModel)]="passwordOptions.minNumber"
/> />
</div> </div>
<div class="box-content-row box-content-row-input" appBoxRow> <div class="box-content-row box-content-row-input" appBoxRow>
@ -193,8 +193,8 @@
type="number" type="number"
min="0" min="0"
max="9" max="9"
(blur)="saveOptions()" (blur)="savePasswordOptions()"
[(ngModel)]="options.minSpecial" [(ngModel)]="passwordOptions.minSpecial"
/> />
</div> </div>
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>
@ -202,7 +202,7 @@
<input <input
id="ambiguous" id="ambiguous"
type="checkbox" type="checkbox"
(change)="saveOptions()" (change)="savePasswordOptions()"
[(ngModel)]="avoidAmbiguous" [(ngModel)]="avoidAmbiguous"
/> />
</div> </div>

View File

@ -1,9 +1,12 @@
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { PasswordGeneratorComponent as BasePasswordGeneratorComponent } from "jslib-angular/components/password-generator.component"; import { PasswordGeneratorComponent as BasePasswordGeneratorComponent } from "jslib-angular/components/password-generator.component";
import { I18nService } from "jslib-common/abstractions/i18n.service"; import { I18nService } from "jslib-common/abstractions/i18n.service";
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service"; import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service"; import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { StateService } from "jslib-common/abstractions/state.service";
import { UsernameGenerationService } from "jslib-common/abstractions/usernameGeneration.service";
@Component({ @Component({
selector: "app-password-generator", selector: "app-password-generator",
@ -12,9 +15,20 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent { export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
constructor( constructor(
passwordGenerationService: PasswordGenerationService, passwordGenerationService: PasswordGenerationService,
usernameGenerationService: UsernameGenerationService,
stateService: StateService,
platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService i18nService: I18nService,
route: ActivatedRoute
) { ) {
super(passwordGenerationService, platformUtilsService, i18nService, window); super(
passwordGenerationService,
usernameGenerationService,
platformUtilsService,
stateService,
i18nService,
route,
window
);
} }
} }