mirror of
https://github.com/bitwarden/jslib
synced 2025-12-16 00:03:38 +00:00
Deprecate LogIn...Complete methods
Add TwoFactorData to main LogIn methods and handle null instead of having duplicative methods
This commit is contained in:
@@ -190,7 +190,7 @@ describe("Cipher Service", () => {
|
||||
const expected = newAuthResponse();
|
||||
|
||||
// Act
|
||||
const result = await authService.logIn(email, masterPassword);
|
||||
const result = await authService.logIn(email, masterPassword, null);
|
||||
|
||||
// Assert
|
||||
// Api call:
|
||||
@@ -240,7 +240,7 @@ describe("Cipher Service", () => {
|
||||
expected.captchaSiteKey = siteKey;
|
||||
|
||||
// Act
|
||||
const result = await authService.logIn(email, masterPassword);
|
||||
const result = await authService.logIn(email, masterPassword, null);
|
||||
|
||||
// Assertions
|
||||
stateService.didNotReceive().addAccount(Arg.any());
|
||||
@@ -274,7 +274,7 @@ describe("Cipher Service", () => {
|
||||
);
|
||||
|
||||
// Act
|
||||
const result = await authService.logIn(email, masterPassword);
|
||||
const result = await authService.logIn(email, masterPassword, null);
|
||||
|
||||
// Assertions
|
||||
commonSuccessAssertions();
|
||||
@@ -293,7 +293,7 @@ describe("Cipher Service", () => {
|
||||
tokenService.getTwoFactorToken(email).resolves(null);
|
||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
||||
|
||||
const result = await authService.logIn(email, masterPassword);
|
||||
const result = await authService.logIn(email, masterPassword, null);
|
||||
|
||||
commonSuccessAssertions();
|
||||
apiService.received(1).postAccountKeys(Arg.any());
|
||||
@@ -317,7 +317,7 @@ describe("Cipher Service", () => {
|
||||
expected.twoFactorProviders = twoFactorProviders;
|
||||
expected.captchaSiteKey = undefined;
|
||||
|
||||
const result = await authService.logIn(email, masterPassword);
|
||||
const result = await authService.logIn(email, masterPassword, null);
|
||||
|
||||
stateService.didNotReceive().addAccount(Arg.any());
|
||||
messagingService.didNotReceive().send(Arg.any());
|
||||
@@ -332,7 +332,7 @@ describe("Cipher Service", () => {
|
||||
authService.masterPasswordHash = hashedPassword;
|
||||
authService.localMasterPasswordHash = localHashedPassword;
|
||||
|
||||
await authService.logInTwoFactor(twoFactorProviderType, twoFactorToken, twoFactorRemember);
|
||||
await authService.logInTwoFactor({ provider: twoFactorProviderType, token: twoFactorToken, remember: twoFactorRemember });
|
||||
|
||||
apiService.received(1).postIdentityToken(
|
||||
Arg.is((actual) => {
|
||||
@@ -359,7 +359,7 @@ describe("Cipher Service", () => {
|
||||
tokenService.getTwoFactorToken(null).resolves(null);
|
||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
||||
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, null, ssoOrgId);
|
||||
|
||||
// Assert
|
||||
// Api call:
|
||||
@@ -405,7 +405,7 @@ describe("Cipher Service", () => {
|
||||
tokenService.getTwoFactorToken(null).resolves(null);
|
||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
||||
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, null, ssoOrgId);
|
||||
|
||||
// Assert
|
||||
cryptoService.didNotReceive().setEncPrivateKey(privateKey);
|
||||
@@ -419,7 +419,7 @@ describe("Cipher Service", () => {
|
||||
|
||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
||||
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, null, ssoOrgId);
|
||||
|
||||
commonSuccessAssertions();
|
||||
keyConnectorService.received(1).getAndSetKey(keyConnectorUrl);
|
||||
@@ -453,7 +453,7 @@ describe("Cipher Service", () => {
|
||||
|
||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
||||
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
|
||||
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, null, ssoOrgId);
|
||||
|
||||
commonSuccessAssertions();
|
||||
cryptoService.received(1).setKey(preloginKey);
|
||||
@@ -482,7 +482,7 @@ describe("Cipher Service", () => {
|
||||
const tokenResponse = newTokenResponse();
|
||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
||||
|
||||
const result = await authService.logInApiKey(apiClientId, apiClientSecret);
|
||||
const result = await authService.logInApiKey(apiClientId, apiClientSecret, null);
|
||||
|
||||
apiService.received(1).postIdentityToken(
|
||||
Arg.is((actual) => {
|
||||
|
||||
Reference in New Issue
Block a user