Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove routing logic from login and 2fa #6565

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions apps/browser/src/auth/popup/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/ge
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";

import { flagEnabled } from "../../platform/flags";
import { BrowserRouterService } from "../../platform/popup/services/browser-router.service";

@Component({
selector: "app-login",
Expand All @@ -45,8 +44,7 @@ export class LoginComponent extends BaseLoginComponent {
formBuilder: FormBuilder,
formValidationErrorService: FormValidationErrorsService,
route: ActivatedRoute,
loginService: LoginService,
private routerService: BrowserRouterService
loginService: LoginService
) {
super(
devicesApiService,
Expand All @@ -72,16 +70,6 @@ export class LoginComponent extends BaseLoginComponent {

super.successRoute = "/tabs/vault";

super.onSuccessfulLoginNavigate = async () => {
const previousUrl = this.routerService.getPreviousUrl();

if (previousUrl) {
this.router.navigateByUrl(previousUrl);
} else {
this.router.navigate([this.successRoute]);
}
};

this.showPasswordless = flagEnabled("showPasswordless");

if (this.showPasswordless) {
Expand Down
12 changes: 0 additions & 12 deletions apps/browser/src/auth/popup/two-factor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv
import { DialogService } from "@bitwarden/components";

import { BrowserApi } from "../../platform/browser/browser-api";
import { BrowserRouterService } from "../../platform/popup/services/browser-router.service";
import { PopupUtilsService } from "../../popup/services/popup-utils.service";

const BroadcasterSubscriptionId = "TwoFactorComponent";
Expand Down Expand Up @@ -53,7 +52,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
loginService: LoginService,
configService: ConfigServiceAbstraction,
private dialogService: DialogService,
private routerService: BrowserRouterService,
@Inject(WINDOW) protected win: Window
) {
super(
Expand Down Expand Up @@ -86,16 +84,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {

super.successRoute = "/tabs/vault";

super.onSuccessfulLoginNavigate = async () => {
const previousUrl = this.routerService.getPreviousUrl();

if (previousUrl) {
this.router.navigateByUrl(previousUrl);
} else {
this.router.navigate([this.successRoute]);
}
};

// FIXME: Chromium 110 has broken WebAuthn support in extensions via an iframe
this.webAuthnNewTab = true;
}
Expand Down
8 changes: 4 additions & 4 deletions apps/browser/src/popup/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const routes: Routes = [
path: "home",
component: HomeComponent,
canActivate: [UnauthGuard],
data: { state: "home", doNotSaveUrl: true },
data: { state: "home" },
},
{
path: "fido2",
Expand All @@ -85,7 +85,7 @@ const routes: Routes = [
path: "login",
component: LoginComponent,
canActivate: [UnauthGuard],
data: { state: "login", doNotSaveUrl: true },
data: { state: "login" },
},
{
path: "login-with-device",
Expand All @@ -109,13 +109,13 @@ const routes: Routes = [
path: "2fa",
component: TwoFactorComponent,
canActivate: [UnauthGuard],
data: { state: "2fa", doNotSaveUrl: true },
data: { state: "2fa" },
},
{
path: "2fa-options",
component: TwoFactorOptionsComponent,
canActivate: [UnauthGuard],
data: { state: "2fa-options", doNotSaveUrl: true },
data: { state: "2fa-options" },
},
{
path: "login-initiated",
Expand Down