mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
chore(feature-flag): Removed pm-28325-remove-pm-22110-disable-alternate-login-methods flag
This commit is contained in:
@@ -25,7 +25,6 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
|
|||||||
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.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 { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@@ -181,13 +180,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
|||||||
message: this.i18nService.t("unlinkedSso"),
|
message: this.i18nService.t("unlinkedSso"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const disableAlternateLoginMethodsFlagEnabled = await this.configService.getFeatureFlag(
|
await this.removeEmailFromSsoRequiredCacheIfPresent();
|
||||||
FeatureFlag.PM22110_DisableAlternateLoginMethods,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (disableAlternateLoginMethodsFlagEnabled) {
|
|
||||||
await this.removeEmailFromSsoRequiredCacheIfPresent();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
@@ -214,13 +207,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
|||||||
message: this.i18nService.t("leftOrganization"),
|
message: this.i18nService.t("leftOrganization"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const disableAlternateLoginMethodsFlagEnabled = await this.configService.getFeatureFlag(
|
await this.removeEmailFromSsoRequiredCacheIfPresent();
|
||||||
FeatureFlag.PM22110_DisableAlternateLoginMethods,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (disableAlternateLoginMethodsFlagEnabled) {
|
|
||||||
await this.removeEmailFromSsoRequiredCacheIfPresent();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,14 +205,9 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
await this.loadRememberedEmail();
|
await this.loadRememberedEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
const disableAlternateLoginMethodsFlagEnabled = await this.configService.getFeatureFlag(
|
// This SSO required check should come after email has had a chance to be pre-filled (if it
|
||||||
FeatureFlag.PM22110_DisableAlternateLoginMethods,
|
// was found in query params or was the remembered email)
|
||||||
);
|
await this.determineIfSsoRequired();
|
||||||
if (disableAlternateLoginMethodsFlagEnabled) {
|
|
||||||
// This SSO required check should come after email has had a chance to be pre-filled (if it
|
|
||||||
// was found in query params or was the remembered email)
|
|
||||||
await this.determineIfSsoRequired();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async desktopOnInit(): Promise<void> {
|
private async desktopOnInit(): Promise<void> {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { MockProxy, mock } from "jest-mock-extended";
|
import { MockProxy, mock } from "jest-mock-extended";
|
||||||
|
|
||||||
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||||
import { UserId } from "@bitwarden/common/types/guid";
|
import { UserId } from "@bitwarden/common/types/guid";
|
||||||
@@ -58,62 +57,35 @@ describe("DefaultLoginSuccessHandlerService", () => {
|
|||||||
expect(loginEmailService.clearLoginEmail).toHaveBeenCalled();
|
expect(loginEmailService.clearLoginEmail).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when PM22110_DisableAlternateLoginMethods flag is disabled", () => {
|
it("should get SSO email", async () => {
|
||||||
|
await service.run(userId);
|
||||||
|
|
||||||
|
expect(ssoLoginService.getSsoEmail).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("given SSO email is not found", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
configService.getFeatureFlag.mockResolvedValue(false);
|
ssoLoginService.getSsoEmail.mockResolvedValue(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not check SSO requirements", async () => {
|
it("should log error and return early", async () => {
|
||||||
await service.run(userId);
|
await service.run(userId);
|
||||||
|
|
||||||
expect(ssoLoginService.getSsoEmail).not.toHaveBeenCalled();
|
expect(logService.error).toHaveBeenCalledWith("SSO login email not found.");
|
||||||
expect(ssoLoginService.updateSsoRequiredCache).not.toHaveBeenCalled();
|
expect(ssoLoginService.updateSsoRequiredCache).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("given PM22110_DisableAlternateLoginMethods flag is enabled", () => {
|
describe("given SSO email is found", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
configService.getFeatureFlag.mockResolvedValue(true);
|
ssoLoginService.getSsoEmail.mockResolvedValue(testEmail);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should check feature flag", async () => {
|
it("should call updateSsoRequiredCache() and clearSsoEmail()", async () => {
|
||||||
await service.run(userId);
|
await service.run(userId);
|
||||||
|
|
||||||
expect(configService.getFeatureFlag).toHaveBeenCalledWith(
|
expect(ssoLoginService.updateSsoRequiredCache).toHaveBeenCalledWith(testEmail, userId);
|
||||||
FeatureFlag.PM22110_DisableAlternateLoginMethods,
|
expect(ssoLoginService.clearSsoEmail).toHaveBeenCalled();
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should get SSO email", async () => {
|
|
||||||
await service.run(userId);
|
|
||||||
|
|
||||||
expect(ssoLoginService.getSsoEmail).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("given SSO email is not found", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
ssoLoginService.getSsoEmail.mockResolvedValue(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should log error and return early", async () => {
|
|
||||||
await service.run(userId);
|
|
||||||
|
|
||||||
expect(logService.error).toHaveBeenCalledWith("SSO login email not found.");
|
|
||||||
expect(ssoLoginService.updateSsoRequiredCache).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("given SSO email is found", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
ssoLoginService.getSsoEmail.mockResolvedValue(testEmail);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should call updateSsoRequiredCache() and clearSsoEmail()", async () => {
|
|
||||||
await service.run(userId);
|
|
||||||
|
|
||||||
expect(ssoLoginService.updateSsoRequiredCache).toHaveBeenCalledWith(testEmail, userId);
|
|
||||||
expect(ssoLoginService.clearSsoEmail).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||||
import { UserId } from "@bitwarden/common/types/guid";
|
import { UserId } from "@bitwarden/common/types/guid";
|
||||||
@@ -23,20 +22,14 @@ export class DefaultLoginSuccessHandlerService implements LoginSuccessHandlerSer
|
|||||||
await this.userAsymmetricKeysRegenerationService.regenerateIfNeeded(userId);
|
await this.userAsymmetricKeysRegenerationService.regenerateIfNeeded(userId);
|
||||||
await this.loginEmailService.clearLoginEmail();
|
await this.loginEmailService.clearLoginEmail();
|
||||||
|
|
||||||
const disableAlternateLoginMethodsFlagEnabled = await this.configService.getFeatureFlag(
|
const ssoLoginEmail = await this.ssoLoginService.getSsoEmail();
|
||||||
FeatureFlag.PM22110_DisableAlternateLoginMethods,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (disableAlternateLoginMethodsFlagEnabled) {
|
if (!ssoLoginEmail) {
|
||||||
const ssoLoginEmail = await this.ssoLoginService.getSsoEmail();
|
this.logService.error("SSO login email not found.");
|
||||||
|
return;
|
||||||
if (!ssoLoginEmail) {
|
|
||||||
this.logService.error("SSO login email not found.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.ssoLoginService.updateSsoRequiredCache(ssoLoginEmail, userId);
|
|
||||||
await this.ssoLoginService.clearSsoEmail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.ssoLoginService.updateSsoRequiredCache(ssoLoginEmail, userId);
|
||||||
|
await this.ssoLoginService.clearSsoEmail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export enum FeatureFlag {
|
|||||||
BlockClaimedDomainAccountCreation = "block-claimed-domain-account-creation",
|
BlockClaimedDomainAccountCreation = "block-claimed-domain-account-creation",
|
||||||
|
|
||||||
/* Auth */
|
/* Auth */
|
||||||
PM22110_DisableAlternateLoginMethods = "pm-22110-disable-alternate-login-methods",
|
|
||||||
PM23801_PrefetchPasswordPrelogin = "pm-23801-prefetch-password-prelogin",
|
PM23801_PrefetchPasswordPrelogin = "pm-23801-prefetch-password-prelogin",
|
||||||
|
|
||||||
/* Autofill */
|
/* Autofill */
|
||||||
@@ -118,7 +117,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.VaultLoadingSkeletons]: FALSE,
|
[FeatureFlag.VaultLoadingSkeletons]: FALSE,
|
||||||
|
|
||||||
/* Auth */
|
/* Auth */
|
||||||
[FeatureFlag.PM22110_DisableAlternateLoginMethods]: FALSE,
|
|
||||||
[FeatureFlag.PM23801_PrefetchPasswordPrelogin]: FALSE,
|
[FeatureFlag.PM23801_PrefetchPasswordPrelogin]: FALSE,
|
||||||
|
|
||||||
/* Billing */
|
/* Billing */
|
||||||
|
|||||||
Reference in New Issue
Block a user