mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
Enforce Password Generator Policy Options (#469)
* Initial commit for enforcing password generator policy options * Revert to previous isDev URL setup
This commit is contained in:
parent
5ed830205d
commit
a27eddae56
@ -59,19 +59,19 @@
|
|||||||
<div class="col-6 form-group">
|
<div class="col-6 form-group">
|
||||||
<label for="passGenMinLength">{{'minLength' | i18n}}</label>
|
<label for="passGenMinLength">{{'minLength' | i18n}}</label>
|
||||||
<input id="passGenMinLength" class="form-control" type="number" name="PassGenMinLength"
|
<input id="passGenMinLength" class="form-control" type="number" name="PassGenMinLength"
|
||||||
[(ngModel)]="passGenMinLength">
|
min="5" max="128" [(ngModel)]="passGenMinLength">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 form-group">
|
<div class="col-6 form-group">
|
||||||
<label for="passGenMinNumbers">{{'minNumbers' | i18n}}</label>
|
<label for="passGenMinNumbers">{{'minNumbers' | i18n}}</label>
|
||||||
<input id="passGenMinNumbers" class="form-control" type="number" name="PassGenMinNumbers"
|
<input id="passGenMinNumbers" class="form-control" type="number" name="PassGenMinNumbers"
|
||||||
[(ngModel)]="passGenMinNumbers">
|
min="0" max="9" [(ngModel)]="passGenMinNumbers">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 form-group">
|
<div class="col-6 form-group">
|
||||||
<label for="passGenMinSpecial">{{'minSpecial' | i18n}}</label>
|
<label for="passGenMinSpecial">{{'minSpecial' | i18n}}</label>
|
||||||
<input id="passGenMinSpecial" class="form-control" type="number" name="PassGenMinSpecial"
|
<input id="passGenMinSpecial" class="form-control" type="number" name="PassGenMinSpecial"
|
||||||
[(ngModel)]="passGenMinSpecial">
|
min="0" max="9" [(ngModel)]="passGenMinSpecial">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
@ -113,7 +113,7 @@ const lockService = new LockService(cipherService, folderService, collectionServ
|
|||||||
const syncService = new SyncService(userService, apiService, settingsService,
|
const syncService = new SyncService(userService, apiService, settingsService,
|
||||||
folderService, cipherService, cryptoService, collectionService, storageService, messagingService, policyService,
|
folderService, cipherService, cryptoService, collectionService, storageService, messagingService, policyService,
|
||||||
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
||||||
const passwordGenerationService = new PasswordGenerationService(cryptoService, storageService);
|
const passwordGenerationService = new PasswordGenerationService(cryptoService, storageService, policyService);
|
||||||
const totpService = new TotpService(storageService, cryptoFunctionService);
|
const totpService = new TotpService(storageService, cryptoFunctionService);
|
||||||
const containerService = new ContainerService(cryptoService);
|
const containerService = new ContainerService(cryptoService);
|
||||||
const authService = new AuthService(cryptoService, apiService,
|
const authService = new AuthService(cryptoService, apiService,
|
||||||
|
@ -53,34 +53,34 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-4">
|
<div class="form-group col-4">
|
||||||
<label for="min-number">{{'minNumbers' | i18n}}</label>
|
<label for="min-number">{{'minNumbers' | i18n}}</label>
|
||||||
<input id="min-number" class="form-control" type="number" min="0" max="9" (input)="saveOptions()"
|
<input id="min-number" class="form-control" type="number" min="0" max="9" (blur)="saveOptions()"
|
||||||
[(ngModel)]="options.minNumber">
|
[(ngModel)]="options.minNumber" (change)="minNumberChanged()">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-4">
|
<div class="form-group col-4">
|
||||||
<label for="min-special">{{'minSpecial' | i18n}}</label>
|
<label for="min-special">{{'minSpecial' | i18n}}</label>
|
||||||
<input id="min-special" class="form-control" type="number" min="0" max="9" (input)="saveOptions()"
|
<input id="min-special" class="form-control" type="number" min="0" max="9" (blur)="saveOptions()"
|
||||||
[(ngModel)]="options.minSpecial">
|
[(ngModel)]="options.minSpecial" (change)="minSpecialChanged()">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input id="uppercase" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
<input id="uppercase" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
||||||
[(ngModel)]="options.uppercase">
|
[(ngModel)]="options.uppercase" [disabled]="enforcedPolicyOptions?.useUppercase">
|
||||||
<label for="uppercase" class="form-check-label">A-Z</label>
|
<label for="uppercase" class="form-check-label">A-Z</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input id="lowercase" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
<input id="lowercase" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
||||||
[(ngModel)]="options.lowercase">
|
[(ngModel)]="options.lowercase" [disabled]="enforcedPolicyOptions?.useLowercase">
|
||||||
<label for="lowercase" class="form-check-label">a-z</label>
|
<label for="lowercase" class="form-check-label">a-z</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input id="numbers" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
<input id="numbers" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
||||||
[(ngModel)]="options.number">
|
[(ngModel)]="options.number" [disabled]="enforcedPolicyOptions?.useNumbers">
|
||||||
<label for="numbers" class="form-check-label">0-9</label>
|
<label for="numbers" class="form-check-label">0-9</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input id="special" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
<input id="special" class="form-check-input" type="checkbox" (change)="saveOptions()"
|
||||||
[(ngModel)]="options.special">
|
[(ngModel)]="options.special" [disabled]="enforcedPolicyOptions?.useSpecial">
|
||||||
<label for="special" class="form-check-label">!@#$%^&*</label>
|
<label for="special" class="form-check-label">!@#$%^&*</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
@ -47,4 +47,12 @@ export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
|
|||||||
lengthChanged() {
|
lengthChanged() {
|
||||||
document.getElementById('length').focus();
|
document.getElementById('length').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minNumberChanged() {
|
||||||
|
document.getElementById('min-number').focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
minSpecialChanged() {
|
||||||
|
document.getElementById('min-special').focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
async generatePassword(): Promise<boolean> {
|
async generatePassword(): Promise<boolean> {
|
||||||
const confirmed = await super.generatePassword();
|
const confirmed = await super.generatePassword();
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
const options = await this.passwordGenerationService.getOptions();
|
const options = (await this.passwordGenerationService.getOptions())[0];
|
||||||
this.cipher.login.password = await this.passwordGenerationService.generatePassword(options);
|
this.cipher.login.password = await this.passwordGenerationService.generatePassword(options);
|
||||||
}
|
}
|
||||||
return confirmed;
|
return confirmed;
|
||||||
|
Loading…
Reference in New Issue
Block a user