1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-14 10:26:19 +01:00

Stub out dialog

This commit is contained in:
Alec Rippberger 2024-10-31 18:57:34 -05:00
parent 4a2c14dc2e
commit f01163237f
No known key found for this signature in database
GPG Key ID: 9DD8DA583B28154A
6 changed files with 127 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<app-profile></app-profile> <app-profile></app-profile>
<div *ngIf="showChangeEmail$ | async" class="tw-mt-16"> <div *ngIf="showChangeEmail$ | async" class="tw-mt-16">
<h1 bitTypography="h1">{{ "changeEmail" | i18n }}</h1> <h1 bitTypography="h1">{{ "areYouTryingtoLogin" | i18n }}</h1>
<app-change-email></app-change-email> <app-change-email></app-change-email>
</div> </div>
@ -29,4 +29,11 @@
<ng-template #deauthorizeSessionsTemplate></ng-template> <ng-template #deauthorizeSessionsTemplate></ng-template>
<ng-template #viewUserApiKeyTemplate></ng-template> <ng-template #viewUserApiKeyTemplate></ng-template>
<ng-template #rotateUserApiKeyTemplate></ng-template> <ng-template #rotateUserApiKeyTemplate></ng-template>
<!-- TODO: remove this - for testing only -->
<div class="tw-mt-4">
<button type="button" buttonType="secondary" bitButton (click)="openLoginApproval()">
Open Login Approval
</button>
</div>
</bit-container> </bit-container>

View File

@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
import { combineLatest, from, lastValueFrom, map, Observable } from "rxjs"; import { combineLatest, from, lastValueFrom, map, Observable } from "rxjs";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
import { LoginApprovalComponent } from "@bitwarden/auth/angular";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
@ -78,4 +79,15 @@ export class AccountComponent implements OnInit {
const dialogRef = DeleteAccountDialogComponent.open(this.dialogService); const dialogRef = DeleteAccountDialogComponent.open(this.dialogService);
await lastValueFrom(dialogRef.closed); await lastValueFrom(dialogRef.closed);
}; };
// TODO: remove this - for testing only
openLoginApproval() {
LoginApprovalComponent.open(this.dialogService, {
data: {
name: "test name",
userId: "yourUserId",
fingerprint: "test fingerprint",
},
});
}
} }

View File

@ -86,6 +86,12 @@
"atRiskApplications": { "atRiskApplications": {
"message": "At-risk applications" "message": "At-risk applications"
}, },
"deviceType": {
"message": "Device type"
},
"ipAddress": {
"message": "IP address"
},
"totalApplications": { "totalApplications": {
"message": "Total applications" "message": "Total applications"
}, },

View File

@ -58,3 +58,6 @@ export * from "./vault-timeout-input/vault-timeout-input.component";
// self hosted environment configuration dialog // self hosted environment configuration dialog
export * from "./self-hosted-env-config-dialog/self-hosted-env-config-dialog.component"; export * from "./self-hosted-env-config-dialog/self-hosted-env-config-dialog.component";
// login approval
export * from "./login/login-approval.component";

View File

@ -0,0 +1,28 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="default">
<span bitDialogTitle>
{{ "areYouTryingtoLogin" | i18n }}
<span class="tw-text-muted" bitTypography="body1">{{ name }}</span>
</span>
<ng-container bitDialogContent>
<h3 bitTypography="h3" class="tw-mt-4">{{ "fingerprintPhraseHeader" | i18n }}</h3>
<p bitTypography="body1">
<code>{{ fingerprint }}</code>
</p>
<h3 bitTypography="h3" class="tw-mt-4">{{ "deviceType" | i18n }}</h3>
<p bitTypography="body1">test</p>
<h3 bitTypography="h3" class="tw-mt-4">{{ "ipAddress" | i18n }}</h3>
<p bitTypography="body1">test</p>
<h3 bitTypography="h3" class="tw-mt-4">{{ "time" | i18n }}</h3>
<p bitTypography="body1">test</p>
</ng-container>
<ng-container bitDialogFooter>
<button bitButton bitFormButton type="submit" buttonType="primary">
{{ "confirm" | i18n }}
</button>
<button bitButton bitFormButton type="button" buttonType="secondary" bitDialogClose>
{{ "cancel" | i18n }}
</button>
</ng-container>
</bit-dialog>
</form>

View File

@ -0,0 +1,70 @@
import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog";
import { CommonModule } from "@angular/common";
import { Component, Inject, OnInit } from "@angular/core";
import { FormGroup, ReactiveFormsModule } from "@angular/forms";
import { RouterLink } from "@angular/router";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import {
AsyncActionsModule,
ButtonModule,
DialogModule,
DialogService,
FormFieldModule,
} from "@bitwarden/components";
export type LoginApprovalDialogData = {
name: string;
userId: string;
fingerprint: string;
};
@Component({
selector: "login-approval",
templateUrl: "login-approval.component.html",
standalone: true,
imports: [
CommonModule,
JslibModule,
ReactiveFormsModule,
FormFieldModule,
AsyncActionsModule,
RouterLink,
ButtonModule,
DialogModule,
],
})
export class LoginApprovalComponent implements OnInit {
name: string;
userId: string;
fingerprint: string;
loading = true;
formPromise: Promise<any>;
formGroup = new FormGroup({});
constructor(
@Inject(DIALOG_DATA) protected data: LoginApprovalDialogData,
private dialogRef: DialogRef,
) {
this.name = data.name;
this.userId = data.userId;
}
async ngOnInit() {
this.loading = false;
}
submit = async () => {
if (this.loading) {
return;
}
this.dialogRef.close();
};
static open(dialogService: DialogService, config: DialogConfig<LoginApprovalDialogData>) {
return dialogService.open(LoginApprovalComponent, config);
}
}