1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

chore(captcha): [PM-15162] Remove handling of captcha enforcement and bypass token

* Removed captcha references.

* Removed connectors from webpack

* Fixed extra parameter.

* Resolve merge conflicts.

* Fixed extra argument.

* Fixed failing tests.

* Fixed failing test.

* Accessibility cookie cleanup

* Cleaned up accessibility component.

* Deleted old registration endpoint

* Remove unused register request object.

* Fixed merge error that changed font family.

* Fixed formatting from merge.

* Linting
This commit is contained in:
Todd Martin
2025-05-09 10:44:11 -04:00
committed by GitHub
parent 625256b08e
commit 4191bb9533
59 changed files with 56 additions and 977 deletions

View File

@@ -44,7 +44,6 @@ import {
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { LockComponent } from "@bitwarden/key-management-ui";
import { AccessibilityCookieComponent } from "../auth/accessibility-cookie.component";
import { maxAccountsGuardFn } from "../auth/guards/max-accounts.guard";
import { SetPasswordComponent } from "../auth/set-password.component";
import { UpdateTempPasswordComponent } from "../auth/update-temp-password.component";
@@ -111,7 +110,6 @@ const routes: Routes = [
canActivate: [authGuard],
},
}),
{ path: "accessibility-cookie", component: AccessibilityCookieComponent },
{ path: "set-password", component: SetPasswordComponent },
{
path: "send",

View File

@@ -10,7 +10,6 @@ import { ColorPasswordCountPipe } from "@bitwarden/angular/pipes/color-password-
import { ColorPasswordPipe } from "@bitwarden/angular/pipes/color-password.pipe";
import { CalloutModule, DialogModule } from "@bitwarden/components";
import { AccessibilityCookieComponent } from "../auth/accessibility-cookie.component";
import { DeleteAccountComponent } from "../auth/delete-account.component";
import { LoginModule } from "../auth/login/login.module";
import { SetPasswordComponent } from "../auth/set-password.component";
@@ -59,7 +58,6 @@ import { SharedModule } from "./shared/shared.module";
VaultV2Component,
],
declarations: [
AccessibilityCookieComponent,
AccountSwitcherComponent,
AddEditComponent,
AddEditCustomFieldsComponent,

View File

@@ -1,34 +0,0 @@
<form id="accessibility-cookie-page" #form [formGroup]="accessibilityForm" (ngSubmit)="submit()">
<div class="content">
<h1>{{ "loadAccessibilityCookie" | i18n }}</h1>
<p>
{{ "registerAccessibilityUser" | i18n }}
<a (click)="registerhCaptcha()">hcaptcha.com</a>.
{{ "copyPasteLink" | i18n }}
</p>
<div class="box last">
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="link">{{ "hCaptchaUrl" | i18n }}</label>
<input
id="link"
type="text"
name="Link"
aria-describedby="linkHelp"
formControlName="link"
placeholder="{{ 'ex' | i18n }} https://accounts.hcaptcha.com/verify_email"
appAutofocus
appInputVerbatim
/>
</div>
</div>
<div id="linkHelp" class="box-footer">{{ "enterhCaptchaUrl" | i18n }}</div>
</div>
<div class="buttons">
<button type="submit" class="btn primary block" [disabled]="!accessibilityForm.valid">
{{ "submit" | i18n }}
</button>
<button type="button" (click)="close()" class="btn block">{{ "done" | i18n }}</button>
</div>
</div>
</form>

View File

@@ -1,76 +0,0 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Component, NgZone } from "@angular/core";
import { UntypedFormControl, UntypedFormGroup, Validators } from "@angular/forms";
import { Router } from "@angular/router";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { ToastService } from "@bitwarden/components";
@Component({
selector: "app-accessibility-cookie",
templateUrl: "accessibility-cookie.component.html",
})
export class AccessibilityCookieComponent {
listenForCookie = false;
hCaptchaWindow: Window;
accessibilityForm = new UntypedFormGroup({
link: new UntypedFormControl("", Validators.required),
});
constructor(
protected router: Router,
protected platformUtilsService: PlatformUtilsService,
protected environmentService: EnvironmentService,
protected i18nService: I18nService,
protected ngZone: NgZone,
private toastService: ToastService,
) {}
registerhCaptcha() {
this.platformUtilsService.launchUri("https://www.hcaptcha.com/accessibility");
}
async close() {
const [cookie] = await ipc.auth.getHcaptchaAccessibilityCookie();
if (cookie) {
this.onCookieSavedSuccess();
} else {
this.onCookieSavedFailure();
}
await this.router.navigate(["/login"]);
}
onCookieSavedSuccess() {
this.toastService.showToast({
variant: "success",
title: null,
message: this.i18nService.t("accessibilityCookieSaved"),
});
}
onCookieSavedFailure() {
this.toastService.showToast({
variant: "error",
title: null,
message: this.i18nService.t("noAccessibilityCookieSaved"),
});
}
async submit() {
if (Utils.getHostname(this.accessibilityForm.value.link) !== "accounts.hcaptcha.com") {
this.toastService.showToast({
variant: "error",
title: this.i18nService.t("errorOccurred"),
message: this.i18nService.t("invalidUrl"),
});
return;
}
this.listenForCookie = true;
window.open(this.accessibilityForm.value.link, "_blank", "noopener noreferrer");
}
}

View File

@@ -1,9 +1,6 @@
import { ipcRenderer } from "electron";
export default {
getHcaptchaAccessibilityCookie: (): Promise<[string]> =>
ipcRenderer.invoke("getCookie", { url: "https://www.hcaptcha.com/", name: "hc_accessibility" }),
loginRequest: (alertTitle: string, alertBody: string, buttonText: string): Promise<void> =>
ipcRenderer.invoke("loginRequest", {
alertTitle,

View File

@@ -1725,40 +1725,9 @@
"filePasswordAndConfirmFilePasswordDoNotMatch": {
"message": "“File password” and “Confirm file password“ do not match."
},
"hCaptchaUrl": {
"message": "hCaptcha Url",
"description": "hCaptcha is the name of a website, should not be translated"
},
"loadAccessibilityCookie": {
"message": "Load accessibility cookie"
},
"registerAccessibilityUser": {
"message": "Register as an accessibility user at",
"description": "ex. Register as an accessibility user at hcaptcha.com"
},
"copyPasteLink": {
"message": "Copy and paste the link sent to your email below"
},
"enterhCaptchaUrl": {
"message": "Enter URL to load accessibility cookie for hCaptcha",
"description": "hCaptcha is the name of a website, should not be translated"
},
"hCaptchaUrlRequired": {
"message": "hCaptcha Url is required",
"description": "hCaptcha is the name of a website, should not be translated"
},
"invalidUrl": {
"message": "Invalid Url"
},
"done": {
"message": "Done"
},
"accessibilityCookieSaved": {
"message": "Accessibility cookie saved!"
},
"noAccessibilityCookieSaved": {
"message": "No accessibility cookie saved"
},
"warning": {
"message": "WARNING",
"description": "WARNING (should stay in capitalized letters if the language permits)"

View File

@@ -252,12 +252,6 @@ p.lead {
}
}
#hcaptcha_iframe {
width: 100%;
border: none;
transition: height 0.25s linear;
}
form,
.form {
.form-group {

View File

@@ -23,7 +23,6 @@
}
}
#accessibility-cookie-page,
#register-page,
#hint-page,
#update-temp-password-page,
@@ -43,7 +42,6 @@
}
}
#accessibility-cookie-page,
#register-page,
#hint-page,
#lock-page,

View File

@@ -52,10 +52,6 @@ export class ElectronMainMessagingService implements MessageSender {
return windowMain.win?.isVisible();
});
ipcMain.handle("getCookie", async (event, options) => {
return await this.windowMain.session.cookies.get(options);
});
ipcMain.handle("loginRequest", async (event, options) => {
const alert = new Notification({
title: options.alertTitle,