generator updates (#1469)

* generator updates

* update jslib
This commit is contained in:
Kyle Spearrin 2022-03-31 18:49:53 -04:00 committed by GitHub
parent 72405ebe87
commit b4cec5b46f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 30 deletions

2
jslib

@ -1 +1 @@
Subproject commit 56f5aba11ee7faadd2573df145e0387569641672 Subproject commit 4d58200ee90fb4fafa5d4f9f4c957654d4da306d

View File

@ -43,8 +43,8 @@ import { PremiumComponent } from "./accounts/premium.component";
import { SettingsComponent } from "./accounts/settings.component"; import { SettingsComponent } from "./accounts/settings.component";
import { ExportComponent } from "./vault/export.component"; import { ExportComponent } from "./vault/export.component";
import { FolderAddEditComponent } from "./vault/folder-add-edit.component"; import { FolderAddEditComponent } from "./vault/folder-add-edit.component";
import { GeneratorComponent } from "./vault/generator.component";
import { PasswordGeneratorHistoryComponent } from "./vault/password-generator-history.component"; import { PasswordGeneratorHistoryComponent } from "./vault/password-generator-history.component";
import { PasswordGeneratorComponent } from "./vault/password-generator.component";
const BroadcasterSubscriptionId = "AppComponent"; const BroadcasterSubscriptionId = "AppComponent";
const IdleTimeout = 60000 * 10; // 10 minutes const IdleTimeout = 60000 * 10; // 10 minutes
@ -65,7 +65,7 @@ const systemTimeoutOptions = {
<ng-template #passwordHistory></ng-template> <ng-template #passwordHistory></ng-template>
<ng-template #appFolderAddEdit></ng-template> <ng-template #appFolderAddEdit></ng-template>
<ng-template #exportVault></ng-template> <ng-template #exportVault></ng-template>
<ng-template #appPasswordGenerator></ng-template> <ng-template #appGenerator></ng-template>
<app-header></app-header> <app-header></app-header>
<div id="container"> <div id="container">
<div class="loading" *ngIf="loading"> <div class="loading" *ngIf="loading">
@ -84,8 +84,8 @@ export class AppComponent implements OnInit {
exportVaultModalRef: ViewContainerRef; exportVaultModalRef: ViewContainerRef;
@ViewChild("appFolderAddEdit", { read: ViewContainerRef, static: true }) @ViewChild("appFolderAddEdit", { read: ViewContainerRef, static: true })
folderAddEditModalRef: ViewContainerRef; folderAddEditModalRef: ViewContainerRef;
@ViewChild("appPasswordGenerator", { read: ViewContainerRef, static: true }) @ViewChild("appGenerator", { read: ViewContainerRef, static: true })
passwordGeneratorModalRef: ViewContainerRef; generatorModalRef: ViewContainerRef;
loading = false; loading = false;
@ -408,9 +408,9 @@ export class AppComponent implements OnInit {
} }
[this.modal] = await this.modalService.openViewRef( [this.modal] = await this.modalService.openViewRef(
PasswordGeneratorComponent, GeneratorComponent,
this.passwordGeneratorModalRef, this.generatorModalRef,
(comp) => (comp.showSelect = false) (comp) => (comp.comingFromAddEdit = false)
); );
this.modal.onClosed.subscribe(() => { this.modal.onClosed.subscribe(() => {

View File

@ -99,9 +99,9 @@ import { CiphersComponent } from "./vault/ciphers.component";
import { CollectionsComponent } from "./vault/collections.component"; import { CollectionsComponent } from "./vault/collections.component";
import { ExportComponent } from "./vault/export.component"; import { ExportComponent } from "./vault/export.component";
import { FolderAddEditComponent } from "./vault/folder-add-edit.component"; import { FolderAddEditComponent } from "./vault/folder-add-edit.component";
import { GeneratorComponent } from "./vault/generator.component";
import { GroupingsComponent } from "./vault/groupings.component"; import { GroupingsComponent } from "./vault/groupings.component";
import { PasswordGeneratorHistoryComponent } from "./vault/password-generator-history.component"; import { PasswordGeneratorHistoryComponent } from "./vault/password-generator-history.component";
import { PasswordGeneratorComponent } from "./vault/password-generator.component";
import { PasswordHistoryComponent } from "./vault/password-history.component"; import { PasswordHistoryComponent } from "./vault/password-history.component";
import { ShareComponent } from "./vault/share.component"; import { ShareComponent } from "./vault/share.component";
import { VaultComponent } from "./vault/vault.component"; import { VaultComponent } from "./vault/vault.component";
@ -193,7 +193,7 @@ registerLocaleData(localeZhTw, "zh-TW");
LockComponent, LockComponent,
LoginComponent, LoginComponent,
NavComponent, NavComponent,
PasswordGeneratorComponent, GeneratorComponent,
PasswordGeneratorHistoryComponent, PasswordGeneratorHistoryComponent,
PasswordHistoryComponent, PasswordHistoryComponent,
PasswordRepromptComponent, PasswordRepromptComponent,

View File

@ -81,7 +81,7 @@
[value]="o.value" [value]="o.value"
(change)="typeChanged()" (change)="typeChanged()"
[checked]="type === o.value" [checked]="type === o.value"
[disabled]="showSelect" [disabled]="comingFromAddEdit"
/> />
<label class="unstyled" for="type_{{ o.value }}"> <label class="unstyled" for="type_{{ o.value }}">
{{ o.name }} {{ o.name }}
@ -296,7 +296,18 @@
</div> </div>
<div class="box-content condensed" [hidden]="!showOptions"> <div class="box-content condensed" [hidden]="!showOptions">
<div class="box-content-row box-content-row-radio"> <div class="box-content-row box-content-row-radio">
<label class="radio-header">{{ "usernameType" | i18n }}</label> <label class="radio-header">
{{ "usernameType" | i18n }}
<a
href="#"
appStopClick
appBlurClick
(click)="usernameTypesLearnMore()"
appA11yTitle="{{ 'learnMore' | i18n }}"
>
<i class="bwi bwi-question-circle" aria-hidden="true"></i>
</a>
</label>
<div <div
class="radio-group align-start text-default" class="radio-group align-start text-default"
appBoxRow appBoxRow
@ -371,7 +382,7 @@
</label> </label>
</div> </div>
</div> </div>
<div class="box-content-row" appBoxRow *ngIf="showWebsiteOption"> <div class="box-content-row" appBoxRow *ngIf="usernameWebsite">
<label for="subaddress-website">{{ "website" | i18n }}</label> <label for="subaddress-website">{{ "website" | i18n }}</label>
<input <input
id="subaddress-website" id="subaddress-website"
@ -413,7 +424,7 @@
</label> </label>
</div> </div>
</div> </div>
<div class="box-content-row" appBoxRow *ngIf="showWebsiteOption"> <div class="box-content-row" appBoxRow *ngIf="usernameWebsite">
<label for="catchall-website">{{ "website" | i18n }}</label> <label for="catchall-website">{{ "website" | i18n }}</label>
<input <input
id="catchall-website" id="catchall-website"
@ -455,14 +466,14 @@
type="button" type="button"
class="primary" class="primary"
appBlurClick appBlurClick
*ngIf="showSelect" *ngIf="comingFromAddEdit"
(click)="select()" (click)="select()"
appA11yTitle="{{ 'select' | i18n }}" appA11yTitle="{{ 'select' | i18n }}"
> >
<i class="bwi bwi-lg bwi-fw bwi-check" aria-hidden="true"></i> <i class="bwi bwi-lg bwi-fw bwi-check" aria-hidden="true"></i>
</button> </button>
<button type="button" data-dismiss="modal"> <button type="button" data-dismiss="modal">
{{ (showSelect ? "cancel" : "close") | i18n }} {{ (comingFromAddEdit ? "cancel" : "close") | i18n }}
</button> </button>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { PasswordGeneratorComponent as BasePasswordGeneratorComponent } from "jslib-angular/components/password-generator.component"; import { GeneratorComponent as BaseGeneratorComponent } from "jslib-angular/components/generator.component";
import { I18nService } from "jslib-common/abstractions/i18n.service"; import { I18nService } from "jslib-common/abstractions/i18n.service";
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service"; import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service"; import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
@ -9,10 +9,10 @@ import { StateService } from "jslib-common/abstractions/state.service";
import { UsernameGenerationService } from "jslib-common/abstractions/usernameGeneration.service"; import { UsernameGenerationService } from "jslib-common/abstractions/usernameGeneration.service";
@Component({ @Component({
selector: "app-password-generator", selector: "app-generator",
templateUrl: "password-generator.component.html", templateUrl: "generator.component.html",
}) })
export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent { export class GeneratorComponent extends BaseGeneratorComponent {
constructor( constructor(
passwordGenerationService: PasswordGenerationService, passwordGenerationService: PasswordGenerationService,
usernameGenerationService: UsernameGenerationService, usernameGenerationService: UsernameGenerationService,
@ -31,4 +31,8 @@ export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
window window
); );
} }
usernameTypesLearnMore() {
this.platformUtilsService.launchUri("https://bitwarden.com/help/generator/#username-types");
}
} }

View File

@ -66,7 +66,7 @@
> >
</app-vault-groupings> </app-vault-groupings>
</div> </div>
<ng-template #passwordGenerator></ng-template> <ng-template #generator></ng-template>
<ng-template #attachments></ng-template> <ng-template #attachments></ng-template>
<ng-template #collections></ng-template> <ng-template #collections></ng-template>
<ng-template #share></ng-template> <ng-template #share></ng-template>

View File

@ -35,8 +35,8 @@ import { AttachmentsComponent } from "./attachments.component";
import { CiphersComponent } from "./ciphers.component"; import { CiphersComponent } from "./ciphers.component";
import { CollectionsComponent } from "./collections.component"; import { CollectionsComponent } from "./collections.component";
import { FolderAddEditComponent } from "./folder-add-edit.component"; import { FolderAddEditComponent } from "./folder-add-edit.component";
import { GeneratorComponent } from "./generator.component";
import { GroupingsComponent } from "./groupings.component"; import { GroupingsComponent } from "./groupings.component";
import { PasswordGeneratorComponent } from "./password-generator.component";
import { PasswordHistoryComponent } from "./password-history.component"; import { PasswordHistoryComponent } from "./password-history.component";
import { ShareComponent } from "./share.component"; import { ShareComponent } from "./share.component";
import { ViewComponent } from "./view.component"; import { ViewComponent } from "./view.component";
@ -52,8 +52,8 @@ export class VaultComponent implements OnInit, OnDestroy {
@ViewChild(AddEditComponent) addEditComponent: AddEditComponent; @ViewChild(AddEditComponent) addEditComponent: AddEditComponent;
@ViewChild(CiphersComponent, { static: true }) ciphersComponent: CiphersComponent; @ViewChild(CiphersComponent, { static: true }) ciphersComponent: CiphersComponent;
@ViewChild(GroupingsComponent, { static: true }) groupingsComponent: GroupingsComponent; @ViewChild(GroupingsComponent, { static: true }) groupingsComponent: GroupingsComponent;
@ViewChild("passwordGenerator", { read: ViewContainerRef, static: true }) @ViewChild("generator", { read: ViewContainerRef, static: true })
passwordGeneratorModalRef: ViewContainerRef; generatorModalRef: ViewContainerRef;
@ViewChild("attachments", { read: ViewContainerRef, static: true }) @ViewChild("attachments", { read: ViewContainerRef, static: true })
attachmentsModalRef: ViewContainerRef; attachmentsModalRef: ViewContainerRef;
@ViewChild("passwordHistory", { read: ViewContainerRef, static: true }) @ViewChild("passwordHistory", { read: ViewContainerRef, static: true })
@ -599,7 +599,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.go(); this.go();
} }
async openGenerator(showSelect: boolean, passwordType = true) { async openGenerator(comingFromAddEdit: boolean, passwordType = true) {
if (this.modal != null) { if (this.modal != null) {
this.modal.close(); this.modal.close();
} }
@ -608,15 +608,14 @@ export class VaultComponent implements OnInit, OnDestroy {
const loginType = cipher != null && cipher.type === CipherType.Login && cipher.login != null; const loginType = cipher != null && cipher.type === CipherType.Login && cipher.login != null;
const [modal, childComponent] = await this.modalService.openViewRef( const [modal, childComponent] = await this.modalService.openViewRef(
PasswordGeneratorComponent, GeneratorComponent,
this.passwordGeneratorModalRef, this.generatorModalRef,
(comp) => { (comp) => {
comp.showSelect = showSelect; comp.comingFromAddEdit = comingFromAddEdit;
if (showSelect) { if (comingFromAddEdit) {
comp.type = passwordType ? "password" : "username"; comp.type = passwordType ? "password" : "username";
if (loginType && cipher.login.hasUris && cipher.login.uris[0].hostname != null) { if (loginType && cipher.login.hasUris && cipher.login.uris[0].hostname != null) {
comp.usernameWebsite = cipher.login.uris[0].hostname; comp.usernameWebsite = cipher.login.uris[0].hostname;
comp.showWebsiteOption = true;
} }
} }
} }