mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
Admin config for master password policy (#463)
* Admin config for master password policy * UI cleanup and master pass options improvements * ui tweaks
This commit is contained in:
parent
6129fdb6e5
commit
83ba366558
@ -5,7 +5,7 @@
|
||||
<i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{'loading' | i18n}}</span>
|
||||
</ng-container>
|
||||
<table class="table table-hover table-list">
|
||||
<table class="table table-hover table-list" *ngIf="!loading">
|
||||
<tbody>
|
||||
<tr *ngFor="let p of policies">
|
||||
<td>
|
||||
|
@ -21,27 +21,68 @@
|
||||
</div>
|
||||
</div>
|
||||
<ng-container *ngIf="type === policyType.MasterPassword">
|
||||
<div class="form-group">
|
||||
<label for="masterPassMinLength">{{'minLength' | i18n}}</label>
|
||||
<input id="masterPassMinLength" class="form-control" type="number" name="MasterPassMinLength"
|
||||
[(ngModel)]="masterPassMinLength">
|
||||
<div class="row">
|
||||
<div class="col-6 form-group">
|
||||
<label for="masterPassMinComplexity">{{'minComplexityScore' | i18n}}</label>
|
||||
<input id="masterPassMinComplexity" class="form-control" type="number"
|
||||
name="MasterPassMinComplexity" [(ngModel)]="masterPassMinComplexity" min="0" max="4">
|
||||
</div>
|
||||
<div class="col-6 form-group">
|
||||
<label for="masterPassMinLength">{{'minLength' | i18n}}</label>
|
||||
<input id="masterPassMinLength" class="form-control" type="number"
|
||||
name="MasterPassMinLength" [(ngModel)]="masterPassMinLength">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="masterPassRequireUpper"
|
||||
[(ngModel)]="masterPassRequireUpper" name="MasterPassRequireUpper">
|
||||
<label class="form-check-label" for="masterPassRequireUpper">A-Z</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="masterPassRequireLower"
|
||||
[(ngModel)]="masterPassRequireLower" name="MasterPassRequireLower">
|
||||
<label class="form-check-label" for="masterPassRequireLower">a-z</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="masterPassRequireNumbers"
|
||||
[(ngModel)]="masterPassRequireNumbers" name="MasterPassRequireNumbers">
|
||||
<label class="form-check-label" for="masterPassRequireNumbers">0-9</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="masterPassRequireSpecial"
|
||||
[(ngModel)]="masterPassRequireSpecial" name="MasterPassRequireSpecial">
|
||||
<label class="form-check-label" for="masterPassRequireSpecial">!@#$%^&*</label>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="type === policyType.PasswordGenerator">
|
||||
<div class="form-group">
|
||||
<label for="passGenMinLength">{{'minLength' | i18n}}</label>
|
||||
<input id="passGenMinLength" class="form-control" type="number" name="PassGenMinLength"
|
||||
[(ngModel)]="passGenMinLength">
|
||||
<div class="row">
|
||||
<div class="col-6 form-group">
|
||||
<label for="passGenMinLength">{{'minLength' | i18n}}</label>
|
||||
<input id="passGenMinLength" class="form-control" type="number" name="PassGenMinLength"
|
||||
[(ngModel)]="passGenMinLength">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passGenMinNumbers">{{'minNumbers' | i18n}}</label>
|
||||
<input id="passGenMinNumbers" class="form-control" type="number" name="PassGenMinNumbers"
|
||||
[(ngModel)]="passGenMinNumbers">
|
||||
<div class="row">
|
||||
<div class="col-6 form-group">
|
||||
<label for="passGenMinNumbers">{{'minNumbers' | i18n}}</label>
|
||||
<input id="passGenMinNumbers" class="form-control" type="number" name="PassGenMinNumbers"
|
||||
[(ngModel)]="passGenMinNumbers">
|
||||
</div>
|
||||
<div class="col-6 form-group">
|
||||
<label for="passGenMinSpecial">{{'minSpecial' | i18n}}</label>
|
||||
<input id="passGenMinSpecial" class="form-control" type="number" name="PassGenMinSpecial"
|
||||
[(ngModel)]="passGenMinSpecial">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passGenMinSpecial">{{'minSpecial' | i18n}}</label>
|
||||
<input id="passGenMinSpecial" class="form-control" type="number" name="PassGenMinSpecial"
|
||||
[(ngModel)]="passGenMinSpecial">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="passGenUseUpper"
|
||||
[(ngModel)]="passGenUseUpper" name="PassGenUseUpper">
|
||||
<label class="form-check-label" for="passGenUseUpper">A-Z</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="passGenUseLower"
|
||||
[(ngModel)]="passGenUseLower" name="PassGenUseLower">
|
||||
<label class="form-check-label" for="passGenUseLower">a-z</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="passGenUseNumbers"
|
||||
@ -53,16 +94,6 @@
|
||||
[(ngModel)]="passGenUseSpecial" name="PassGenUseSpecial">
|
||||
<label class="form-check-label" for="passGenUseSpecial">!@#$%^&*</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="passGenUseLower"
|
||||
[(ngModel)]="passGenUseLower" name="PassGenUseLower">
|
||||
<label class="form-check-label" for="passGenUseLower">a-z</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="passGenUseUpper"
|
||||
[(ngModel)]="passGenUseUpper" name="PassGenUseUpper">
|
||||
<label class="form-check-label" for="passGenUseUpper">A-Z</label>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@ -75,4 +106,4 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -10,9 +10,7 @@ import { ToasterService } from 'angular2-toaster';
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { PolicyType } from 'jslib/enums/policyType';
|
||||
|
||||
@ -38,25 +36,27 @@ export class PolicyEditComponent implements OnInit {
|
||||
|
||||
// Master password
|
||||
|
||||
masterPassMinComplexity?: number;
|
||||
masterPassMinLength?: number;
|
||||
|
||||
// TODO
|
||||
masterPassRequireUpper?: number;
|
||||
masterPassRequireLower?: number;
|
||||
masterPassRequireNumbers?: number;
|
||||
masterPassRequireSpecial?: number;
|
||||
|
||||
// Password generator
|
||||
|
||||
passGenMinLength?: number;
|
||||
passGenMinNumbers?: number;
|
||||
passGenMinSpecial?: number;
|
||||
passGenUseNumbers?: boolean;
|
||||
passGenUseSpecial?: boolean;
|
||||
passGenUseUpper?: boolean;
|
||||
passGenUseLower?: boolean;
|
||||
passGenUseNumbers?: boolean;
|
||||
passGenUseSpecial?: boolean;
|
||||
passGenMinNumbers?: number;
|
||||
passGenMinSpecial?: number;
|
||||
|
||||
private policy: PolicyResponse;
|
||||
|
||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
||||
private analytics: Angulartics2, private toasterService: ToasterService,
|
||||
private collectionService: CollectionService, private platformUtilsService: PlatformUtilsService) { }
|
||||
private analytics: Angulartics2, private toasterService: ToasterService) { }
|
||||
|
||||
async ngOnInit() {
|
||||
await this.load();
|
||||
@ -73,15 +73,20 @@ export class PolicyEditComponent implements OnInit {
|
||||
switch (this.type) {
|
||||
case PolicyType.PasswordGenerator:
|
||||
this.passGenMinLength = this.policy.data.minLength;
|
||||
this.passGenUseUpper = this.policy.data.useUpper;
|
||||
this.passGenUseLower = this.policy.data.useLower;
|
||||
this.passGenUseNumbers = this.policy.data.useNumbers;
|
||||
this.passGenUseSpecial = this.policy.data.useSpecial;
|
||||
this.passGenMinNumbers = this.policy.data.minNumbers;
|
||||
this.passGenMinSpecial = this.policy.data.minSpecial;
|
||||
this.passGenUseLower = this.policy.data.useLower;
|
||||
this.passGenUseUpper = this.policy.data.useUpper;
|
||||
this.passGenUseSpecial = this.policy.data.useSpecial;
|
||||
this.passGenUseNumbers = this.policy.data.useNumbers;
|
||||
break;
|
||||
case PolicyType.MasterPassword:
|
||||
this.masterPassMinComplexity = this.policy.data.minComplexity;
|
||||
this.masterPassMinLength = this.policy.data.minLength;
|
||||
this.masterPassRequireUpper = this.policy.data.requireUpper;
|
||||
this.masterPassRequireLower = this.policy.data.requireLower;
|
||||
this.masterPassRequireNumbers = this.policy.data.requireNumbers;
|
||||
this.masterPassRequireSpecial = this.policy.data.requireSpecial;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -105,18 +110,23 @@ export class PolicyEditComponent implements OnInit {
|
||||
switch (this.type) {
|
||||
case PolicyType.PasswordGenerator:
|
||||
request.data = {
|
||||
minLength: this.passGenMinLength,
|
||||
minNumbers: this.passGenMinNumbers,
|
||||
minSpecial: this.passGenMinSpecial,
|
||||
minLength: this.passGenMinLength || null,
|
||||
useUpper: this.passGenUseUpper,
|
||||
useLower: this.passGenUseLower,
|
||||
useNumbers: this.passGenUseNumbers,
|
||||
useSpecial: this.passGenUseSpecial,
|
||||
useLower: this.passGenUseLower,
|
||||
useUpper: this.passGenUseUpper,
|
||||
minNumbers: this.passGenMinNumbers || null,
|
||||
minSpecial: this.passGenMinSpecial || null,
|
||||
};
|
||||
break;
|
||||
case PolicyType.MasterPassword:
|
||||
request.data = {
|
||||
minLength: this.masterPassMinLength,
|
||||
minComplexity: this.masterPassMinComplexity || null,
|
||||
minLength: this.masterPassMinLength || null,
|
||||
requireUpper: this.masterPassRequireUpper,
|
||||
requireLower: this.masterPassRequireLower,
|
||||
requireNumbers: this.masterPassRequireNumbers,
|
||||
requireSpecial: this.masterPassRequireSpecial,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
|
@ -805,6 +805,9 @@
|
||||
"passwordGenerator": {
|
||||
"message": "Password Generator"
|
||||
},
|
||||
"minComplexityScore": {
|
||||
"message": "Minimum Complexity Score"
|
||||
},
|
||||
"minNumbers": {
|
||||
"message": "Minimum Numbers"
|
||||
},
|
||||
@ -2960,4 +2963,4 @@
|
||||
"clone": {
|
||||
"message": "Clone"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user