1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 21:20:27 +00:00

[PM-19814] Add exit button and learn more link.

This commit is contained in:
Jimmy Vo
2025-04-10 15:45:48 -04:00
parent cb4a93fe8d
commit 37c1935f7c
6 changed files with 88 additions and 40 deletions

View File

@@ -0,0 +1,4 @@
<span>Question?</span>
<a href="http://bitwarden.com/help/phishing-detected" bitLink block buttonType="primary">
learn more
</a>

View File

@@ -0,0 +1,34 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AnonLayoutComponent } from "@bitwarden/auth/angular";
import { ButtonModule } from "@bitwarden/components";
import { PopOutComponent } from "../../platform/popup/components/pop-out.component";
import { PopupPageComponent } from "../../platform/popup/layout/popup-page.component";
@Component({
standalone: true,
templateUrl: "learn-more-component.html",
imports: [
AnonLayoutComponent,
CommonModule,
PopOutComponent,
PopupPageComponent,
PopupPageComponent,
CommonModule,
JslibModule,
ButtonModule,
],
})
export class LearnMoreComponent {
constructor(private activatedRoute: ActivatedRoute) {}
closeTab(): void {
globalThis.close();
}
}

View File

@@ -1,19 +1,8 @@
<div>
<div>🏢⚠️</div>
<label>Phishing url</label>:
<input
*ngIf="queryParams$ | async as params"
[value]="params.phishingHost || 'https://catphish.gotcha.io'"
readonly
/>
<div>
<label for="url">Phishing url</label>:
<input
*ngIf="queryParams$ | async as params"
[value]="params.phishingHost || 'https://catphish.gotcha.io'"
readonly
/>
</div>
<a onclick="alert('Exiting...')"> Exit page </a>
</div>
<div>
<span>Question?</span>
<a href="#">Action here</a>
</div>
<a (click)="closeTab()" bitButton block buttonType="primary"> Exit page </a>

View File

@@ -5,8 +5,9 @@ import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute, RouterModule } from "@angular/router";
import { map, Observable, Subject, take } from "rxjs";
import { AnonLayoutComponent } from "@bitwarden/auth/angular";
import { Icon, IconModule } from "@bitwarden/components";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AnonLayoutComponent, InputPasswordComponent } from "@bitwarden/auth/angular";
import { ButtonModule, Icon, IconModule } from "@bitwarden/components";
import { PopOutComponent } from "../../platform/popup/components/pop-out.component";
import { PopupHeaderComponent } from "../../platform/popup/layout/popup-header.component";
@@ -25,9 +26,13 @@ interface ViewData {
IconModule,
PopOutComponent,
PopupPageComponent,
InputPasswordComponent,
PopupHeaderComponent,
RouterModule,
PopupPageComponent,
CommonModule,
JslibModule,
ButtonModule,
RouterModule,
],
})
export class PhishingWarning implements OnInit, OnDestroy {
@@ -58,6 +63,9 @@ export class PhishingWarning implements OnInit, OnDestroy {
})),
);
}
closeTab(): void {
globalThis.close();
}
ngOnDestroy() {
this.destroy$.next();

View File

@@ -227,7 +227,9 @@ export class PhishingDetectionService {
static setupRedirectToWarningPageListener(): void {
BrowserApi.addListener(chrome.runtime.onMessage, async (message, sender, sendResponse) => {
if (message.command === PhishingDetectionCommands.RedirectToWarningPage) {
const phishingWarningPage = chrome.runtime.getURL("popup/index.html#/phishing-warning");
const phishingWarningPage = chrome.runtime.getURL(
"popup/index.html#/security/phishing-warning",
);
const pageWithViewData = `${phishingWarningPage}?phishingHost=${message.phishingHost}`;

View File

@@ -66,6 +66,7 @@ import { BlockedDomainsComponent } from "../autofill/popup/settings/blocked-doma
import { ExcludedDomainsComponent } from "../autofill/popup/settings/excluded-domains.component";
import { NotificationsSettingsComponent } from "../autofill/popup/settings/notifications.component";
import { PremiumV2Component } from "../billing/popup/settings/premium-v2.component";
import { LearnMoreComponent } from "../phishing-detection/pages/learn-more-component";
import { PhishingWarning } from "../phishing-detection/pages/phishing-warning";
import BrowserPopupUtils from "../platform/popup/browser-popup-utils";
import { popupRouterCacheGuard } from "../platform/popup/view-cache/popup-router-cache.service";
@@ -143,24 +144,6 @@ const routes: Routes = [
canActivate: [fido2AuthGuard],
data: { elevation: 1 } satisfies RouteDataProperties,
},
{
path: "",
component: AnonLayoutWrapperComponent,
children: [
{
path: "phishing-warning",
component: PhishingWarning,
data: {
pageIcon: BitwardenLogo,
pageTitle: "Phishing site detected",
pageSubtitle: "Bitwarden has prevented this page from loading.",
showReadonlyHostname: true,
} satisfies AnonLayoutWrapperData,
},
],
},
{
path: "",
component: ExtensionAnonLayoutWrapperComponent,
@@ -709,6 +692,34 @@ const routes: Routes = [
canActivate: [authGuard],
data: { elevation: 2 } satisfies RouteDataProperties,
},
{
path: "security",
component: AnonLayoutWrapperComponent,
children: [
{
path: "phishing-warning",
children: [
{
path: "",
component: PhishingWarning,
},
{
path: "",
component: LearnMoreComponent,
outlet: "secondary",
},
],
data: {
pageIcon: BitwardenLogo,
pageTitle: "Phishing site detected",
pageSubtitle: "Bitwarden has prevented this page from loading.",
showReadonlyHostname: true,
} satisfies AnonLayoutWrapperData,
},
],
},
];
@Injectable()