mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 03:33:54 +00:00
[PM-5951] Migrate org invite state (#9014)
* use deep linked url for org invite instead of separate state * remove organization invite state & fix tests * clear login redirect for SSO JIT users since they are accepted when setting MP * create accept org invite service and consolidate components in module * finish switch to accept org invite service * move logic to accept org service * the rest of the owl * clear org invite along with deep linked route * pr feedback * fix test and add error to catch null invite * pr feedback * clear stored invite if it doesn't match provided one
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Directive, OnInit } from "@angular/core";
|
||||
import { ActivatedRoute, Params, Router } from "@angular/router";
|
||||
import { Subject } from "rxjs";
|
||||
import { Subject, firstValueFrom } from "rxjs";
|
||||
import { first, switchMap, takeUntil } from "rxjs/operators";
|
||||
|
||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
|
||||
@Directive()
|
||||
export abstract class BaseAcceptComponent implements OnInit {
|
||||
@@ -25,7 +26,7 @@ export abstract class BaseAcceptComponent implements OnInit {
|
||||
protected platformUtilService: PlatformUtilsService,
|
||||
protected i18nService: I18nService,
|
||||
protected route: ActivatedRoute,
|
||||
protected stateService: StateService,
|
||||
protected authService: AuthService,
|
||||
) {}
|
||||
|
||||
abstract authedHandler(qParams: Params): Promise<void>;
|
||||
@@ -41,10 +42,10 @@ export abstract class BaseAcceptComponent implements OnInit {
|
||||
);
|
||||
let errorMessage: string = null;
|
||||
if (!error) {
|
||||
this.authed = await this.stateService.getIsAuthenticated();
|
||||
this.email = qParams.email;
|
||||
|
||||
if (this.authed) {
|
||||
const status = await firstValueFrom(this.authService.activeAccountStatus$);
|
||||
if (status !== AuthenticationStatus.LoggedOut) {
|
||||
try {
|
||||
await this.authedHandler(qParams);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user