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": {
"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": {
"message": "Weak Master Password"
},

View File

@ -24,10 +24,16 @@
<div class="box-content-row" appBoxRow>
<div class="box-content-row-flex">
<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'}}"
name="MasterPassword" class="monospaced" [(ngModel)]="masterPassword" required
[appAutofocus]="email !== ''" appInputVerbatim (input)="updatePasswordStrength()">
[appAutofocus]="email !== ''" appInputVerbatim (input)="updatePasswordStrength()">
</div>
<div class="action-buttons">
<a class="row-btn" href="#" appStopClick appBlurClick
@ -38,7 +44,7 @@
</div>
</div>
<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 + '%')}"
attr.aria-valuenow="{{masterPasswordScoreWidth}}"></div>
</div>

View File

@ -23,21 +23,4 @@ export class RegisterComponent extends BaseRegisterComponent {
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
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) {
color: themed('mutedColor');
}
.sub-label {
margin-left: 10px;
}
}
.text, .detail {
@ -376,23 +380,17 @@
.progress {
display: flex;
height: 5px;
overflow: hidden; // force rounded corners by cropping it
font-size: $font-size-small;
margin: 10px -15px -10px;
overflow: hidden;
margin: 5px -15px -10px;
@include themify($themes) {
background-color: themed('borderColor');
.progress-bar {
display: flex;
flex-direction: column;
justify-content: center;
white-space: nowrap;
background-color: $brand-primary;
}
}
.progress-bar {
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
white-space: nowrap;
background-color: $brand-primary;
}
}
&.condensed .box-content-row, .box-content-row.condensed {