add master password strength text

This commit is contained in:
Kyle Spearrin 2018-11-15 15:40:56 -05:00
parent fceabbb4bf
commit 8502ff8fa4
5 changed files with 34 additions and 35 deletions

2
jslib

@ -1 +1 @@
Subproject commit be080f4f17b782fdb22c77560bd235e81346fb21 Subproject commit da47faca5c9a41f732136448461a06fc6e6fe023

View File

@ -1113,6 +1113,18 @@
"whoOwnsThisItem": { "whoOwnsThisItem": {
"message": "Who owns this item?" "message": "Who owns this item?"
}, },
"strong": {
"message": "Strong",
"description": "ex. A strong password. Scale: Weak -> Good -> Strong"
},
"good": {
"message": "Good",
"description": "ex. A good password. Scale: Weak -> Good -> Strong"
},
"weak": {
"message": "Weak",
"description": "ex. A weak password. Scale: Weak -> Good -> Strong"
},
"weakMasterPassword": { "weakMasterPassword": {
"message": "Weak Master Password" "message": "Weak Master Password"
}, },

View File

@ -24,7 +24,13 @@
<div class="box-content-row" appBoxRow> <div class="box-content-row" appBoxRow>
<div class="box-content-row-flex"> <div class="box-content-row-flex">
<div class="row-main"> <div class="row-main">
<label for="masterPassword">{{'masterPass' | i18n}}</label> <label for="masterPassword">
{{'masterPass' | i18n}}
<strong class="sub-label text-{{masterPasswordScoreColor}}"
*ngIf="masterPasswordScoreText">
{{masterPasswordScoreText}}
</strong>
</label>
<input id="masterPassword" type="{{showPassword ? 'text' : 'password'}}" <input id="masterPassword" type="{{showPassword ? 'text' : 'password'}}"
name="MasterPassword" class="monospaced" [(ngModel)]="masterPassword" required name="MasterPassword" class="monospaced" [(ngModel)]="masterPassword" required
[appAutofocus]="email !== ''" appInputVerbatim (input)="updatePasswordStrength()"> [appAutofocus]="email !== ''" appInputVerbatim (input)="updatePasswordStrength()">
@ -38,7 +44,7 @@
</div> </div>
</div> </div>
<div class="progress"> <div class="progress">
<div class="progress-bar {{masterPasswordScoreColor}}" role="progressbar" aria-valuenow="0" <div class="progress-bar bg-{{masterPasswordScoreColor}}" role="progressbar" aria-valuenow="0"
aria-valuemin="0" aria-valuemax="100" [ngStyle]="{width: (masterPasswordScoreWidth + '%')}" aria-valuemin="0" aria-valuemax="100" [ngStyle]="{width: (masterPasswordScoreWidth + '%')}"
attr.aria-valuenow="{{masterPasswordScoreWidth}}"></div> attr.aria-valuenow="{{masterPasswordScoreWidth}}"></div>
</div> </div>

View File

@ -23,21 +23,4 @@ export class RegisterComponent extends BaseRegisterComponent {
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService, super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
passwordGenerationService); passwordGenerationService);
} }
get masterPasswordScoreWidth() {
return this.masterPasswordScore == null ? 0 : (this.masterPasswordScore + 1) * 20;
}
get masterPasswordScoreColor() {
switch (this.masterPasswordScore) {
case 4:
return 'bg-success';
case 3:
return 'bg-primary';
case 2:
return 'bg-warning';
default:
return 'bg-danger';
}
}
} }

View File

@ -84,6 +84,10 @@
@include themify($themes) { @include themify($themes) {
color: themed('mutedColor'); color: themed('mutedColor');
} }
.sub-label {
margin-left: 10px;
}
} }
.text, .detail { .text, .detail {
@ -376,24 +380,18 @@
.progress { .progress {
display: flex; display: flex;
height: 5px; height: 5px;
overflow: hidden; // force rounded corners by cropping it overflow: hidden;
font-size: $font-size-small; margin: 5px -15px -10px;
margin: 10px -15px -10px;
@include themify($themes) {
background-color: themed('borderColor');
}
}
.progress-bar { .progress-bar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
text-align: center;
white-space: nowrap; white-space: nowrap;
background-color: $brand-primary; background-color: $brand-primary;
} }
} }
}
&.condensed .box-content-row, .box-content-row.condensed { &.condensed .box-content-row, .box-content-row.condensed {
padding-top: 5px; padding-top: 5px;