[Callout] Removed redundant code (#1131)

* [Callout] ARemoved redundant code

* Fixed formatting

* Update jslib

* Updated ul styling for policy options callout

* Update jslib
This commit is contained in:
Vincent Salucci 2021-08-30 16:19:31 -05:00 committed by GitHub
parent 1c3488a8db
commit 2e868c8111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 27 additions and 153 deletions

2
jslib

@ -1 +1 @@
Subproject commit daa4f6f9a6dc84d6cd9a937be6b5392d2cf51eca Subproject commit f02720a1c654adeb73d68b73bb61fcf7415041f4

View File

@ -62,24 +62,8 @@
<small class="form-text text-muted">{{'yourNameDesc' | i18n}}</small> <small class="form-text text-muted">{{'yourNameDesc' | i18n}}</small>
</div> </div>
<div class="form-group"> <div class="form-group">
<app-callout type="info" *ngIf="enforcedPolicyOptions"> <app-callout type="info" [enforcedPolicyOptions]="enforcedPolicyOptions"
{{'masterPasswordPolicyInEffect' | i18n}} *ngIf="enforcedPolicyOptions">
<ul class="mb-0">
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">
{{'policyInEffectUppercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireLower">
{{'policyInEffectLowercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
{{'policyInEffectNumbers' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
</ul>
</app-callout> </app-callout>
<label for="masterPassword">{{'masterPass' | i18n}}</label> <label for="masterPassword">{{'masterPass' | i18n}}</label>
<div class="d-flex"> <div class="d-flex">

View File

@ -43,26 +43,6 @@ export class RegisterComponent extends BaseRegisterComponent {
passwordGenerationService, environmentService); passwordGenerationService, environmentService);
} }
getPasswordScoreAlertDisplay() {
if (this.enforcedPolicyOptions == null) {
return '';
}
let str: string;
switch (this.enforcedPolicyOptions.minComplexity) {
case 4:
str = this.i18nService.t('strong');
break;
case 3:
str = this.i18nService.t('good');
break;
default:
str = this.i18nService.t('weak');
break;
}
return str + ' (' + this.enforcedPolicyOptions.minComplexity + ')';
}
async ngOnInit() { async ngOnInit() {
const queryParamsSub = this.route.queryParams.subscribe(qParams => { const queryParamsSub = this.route.queryParams.subscribe(qParams => {
this.referenceData = new ReferenceEventRequest(); this.referenceData = new ReferenceEventRequest();

View File

@ -10,24 +10,8 @@
<div class="card-body" *ngIf="!syncLoading"> <div class="card-body" *ngIf="!syncLoading">
<app-callout type="info">{{'ssoCompleteRegistration' | i18n}}</app-callout> <app-callout type="info">{{'ssoCompleteRegistration' | i18n}}</app-callout>
<div class="form-group"> <div class="form-group">
<app-callout type="info" *ngIf="enforcedPolicyOptions"> <app-callout type="info" [enforcedPolicyOptions]="enforcedPolicyOptions"
{{'masterPasswordPolicyInEffect' | i18n}} *ngIf="enforcedPolicyOptions">
<ul class="mb-0">
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">
{{'policyInEffectUppercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireLower">
{{'policyInEffectLowercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
{{'policyInEffectNumbers' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
</ul>
</app-callout> </app-callout>
<label for="masterPassword">{{'masterPass' | i18n}}</label> <label for="masterPassword">{{'masterPass' | i18n}}</label>
<div class="d-flex"> <div class="d-flex">

View File

@ -7,24 +7,8 @@
<app-callout type="warning">{{'updateMasterPasswordWarning' | i18n}} <app-callout type="warning">{{'updateMasterPasswordWarning' | i18n}}
</app-callout> </app-callout>
<div class="form-group"> <div class="form-group">
<app-callout type="info" *ngIf="enforcedPolicyOptions"> <app-callout type="info" [enforcedPolicyOptions]="enforcedPolicyOptions"
{{'masterPasswordPolicyInEffect' | i18n}} *ngIf="enforcedPolicyOptions">
<ul class="mb-0">
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">
{{'policyInEffectUppercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireLower">
{{'policyInEffectLowercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
{{'policyInEffectNumbers' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
</ul>
</app-callout> </app-callout>
<label for="masterPassword">{{'masterPass' | i18n}}</label> <label for="masterPassword">{{'masterPass' | i18n}}</label>
<div class="d-flex"> <div class="d-flex">

View File

@ -13,24 +13,9 @@
<div class="modal-body"> <div class="modal-body">
<app-callout type="warning">{{'resetPasswordLoggedOutWarning' | i18n: loggedOutWarningName}} <app-callout type="warning">{{'resetPasswordLoggedOutWarning' | i18n: loggedOutWarningName}}
</app-callout> </app-callout>
<app-callout type="info" *ngIf="enforcedPolicyOptions"> <app-callout type="info" [enforcedPolicyOptions]="enforcedPolicyOptions"
{{'resetPasswordMasterPasswordPolicyInEffect' | i18n}} enforcedPolicyMessage="{{'resetPasswordMasterPasswordPolicyInEffect' | i18n}}"
<ul class="mb-0"> *ngIf="enforcedPolicyOptions">
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">
{{'policyInEffectUppercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireLower">
{{'policyInEffectLowercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
{{'policyInEffectNumbers' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
</ul>
</app-callout> </app-callout>
<div class="row"> <div class="row">
<div class="col form-group"> <div class="col form-group">

View File

@ -1,5 +1,4 @@
import { import {
AfterViewInit,
Component, Component,
EventEmitter, EventEmitter,
Input, Input,
@ -17,6 +16,7 @@ import { PolicyService } from 'jslib-common/abstractions/policy.service';
import { EncString } from 'jslib-common/models/domain/encString'; import { EncString } from 'jslib-common/models/domain/encString';
import { MasterPasswordPolicyOptions } from 'jslib-common/models/domain/masterPasswordPolicyOptions'; import { MasterPasswordPolicyOptions } from 'jslib-common/models/domain/masterPasswordPolicyOptions';
import { SymmetricCryptoKey } from 'jslib-common/models/domain/symmetricCryptoKey'; import { SymmetricCryptoKey } from 'jslib-common/models/domain/symmetricCryptoKey';
import { OrganizationUserResetPasswordRequest } from 'jslib-common/models/request/organizationUserResetPasswordRequest'; import { OrganizationUserResetPasswordRequest } from 'jslib-common/models/request/organizationUserResetPasswordRequest';
@Component({ @Component({
@ -50,26 +50,6 @@ export class ResetPasswordComponent implements OnInit {
return this.name != null ? this.name : this.i18nService.t('thisUser'); return this.name != null ? this.name : this.i18nService.t('thisUser');
} }
getPasswordScoreAlertDisplay() {
if (this.enforcedPolicyOptions == null) {
return '';
}
let str: string;
switch (this.enforcedPolicyOptions.minComplexity) {
case 4:
str = this.i18nService.t('strong');
break;
case 3:
str = this.i18nService.t('good');
break;
default:
str = this.i18nService.t('weak');
break;
}
return str + ' (' + this.enforcedPolicyOptions.minComplexity + ')';
}
async generatePassword() { async generatePassword() {
const options = (await this.passwordGenerationService.getOptions())[0]; const options = (await this.passwordGenerationService.getOptions())[0];
this.newPassword = await this.passwordGenerationService.generatePassword(options); this.newPassword = await this.passwordGenerationService.generatePassword(options);

View File

@ -1,18 +1,5 @@
<app-callout type="warning">{{'loggedOutWarning' | i18n}}</app-callout> <app-callout type="warning">{{'loggedOutWarning' | i18n}}</app-callout>
<app-callout type="info" *ngIf="enforcedPolicyOptions"> <app-callout type="info" [enforcedPolicyOptions]="enforcedPolicyOptions" *ngIf="enforcedPolicyOptions">
{{'masterPasswordPolicyInEffect' | i18n}}
<ul class="mb-0">
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">{{'policyInEffectUppercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireLower">{{'policyInEffectLowercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireNumbers">{{'policyInEffectNumbers' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
</ul>
</app-callout> </app-callout>
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" ngNativeValidate autocomplete="off"> <form #form (ngSubmit)="submit()" [appApiAction]="formPromise" ngNativeValidate autocomplete="off">
@ -38,9 +25,8 @@
<div class="col-6"> <div class="col-6">
<div class="form-group"> <div class="form-group">
<label for="masterPasswordRetype">{{'confirmNewMasterPass' | i18n}}</label> <label for="masterPasswordRetype">{{'confirmNewMasterPass' | i18n}}</label>
<input id="masterPasswordRetype" type="password" name="MasterPasswordRetype" <input id="masterPasswordRetype" type="password" name="MasterPasswordRetype" class="form-control"
class="form-control" [(ngModel)]="masterPasswordRetype" required appInputVerbatim [(ngModel)]="masterPasswordRetype" required appInputVerbatim autocomplete="new-password">
autocomplete="new-password">
</div> </div>
</div> </div>
</div> </div>

View File

@ -12,33 +12,18 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<app-callout type="warning">{{'loggedOutWarning' | i18n}}</app-callout> <app-callout type="warning">{{'loggedOutWarning' | i18n}}</app-callout>
<app-callout type="info" *ngIf="enforcedPolicyOptions"> <app-callout type="info" [enforcedPolicyOptions]="enforcedPolicyOptions" *ngIf="enforcedPolicyOptions">
{{'masterPasswordPolicyInEffect' | i18n}}
<ul class="mb-0">
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">
{{'policyInEffectUppercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireLower">
{{'policyInEffectLowercase' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
{{'policyInEffectNumbers' | i18n}}</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
</ul>
</app-callout> </app-callout>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<div class="form-group"> <div class="form-group">
<label for="masterPassword">{{'newMasterPass' | i18n}}</label> <label for="masterPassword">{{'newMasterPass' | i18n}}</label>
<input id="masterPassword" type="password" name="NewMasterPasswordHash" class="form-control mb-1" <input id="masterPassword" type="password" name="NewMasterPasswordHash"
[(ngModel)]="masterPassword" (input)="updatePasswordStrength()" required appInputVerbatim class="form-control mb-1" [(ngModel)]="masterPassword"
(input)="updatePasswordStrength()" required appInputVerbatim
autocomplete="new-password"> autocomplete="new-password">
<app-password-strength [score]="masterPasswordScore" [showText]="true"></app-password-strength> <app-password-strength [score]="masterPasswordScore" [showText]="true">
</app-password-strength>
</div> </div>
</div> </div>
<div class="col-6"> <div class="col-6">
@ -56,7 +41,9 @@
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i> <i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span>{{'save' | i18n}}</span> <span>{{'save' | i18n}}</span>
</button> </button>
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{'cancel' | i18n}}</button> <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">
{{'cancel' | i18n}}
</button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -758,6 +758,10 @@ app-user-billing {
color: $warning; color: $warning;
} }
} }
.enforced-policy-options ul {
margin-bottom: 0px;
}
} }
.list-group-2fa { .list-group-2fa {