@ -11,7 +11,10 @@ import { PlatformUtilsService } from "../../platform/abstractions/platform-utils
@@ -11,7 +11,10 @@ import { PlatformUtilsService } from "../../platform/abstractions/platform-utils
import { StateService } from "../../platform/abstractions/state.service" ;
import { Utils } from "../../platform/misc/utils" ;
import { SymmetricCryptoKey } from "../../platform/models/domain/symmetric-crypto-key" ;
import { PasswordGenerationService } from "../../tools/generator/password" ;
import {
PasswordStrengthService ,
PasswordStrengthServiceAbstraction ,
} from "../../tools/password-strength" ;
import { AuthService } from "../abstractions/auth.service" ;
import { TokenService } from "../abstractions/token.service" ;
import { TwoFactorService } from "../abstractions/two-factor.service" ;
@ -51,7 +54,7 @@ describe("PasswordLogInStrategy", () => {
@@ -51,7 +54,7 @@ describe("PasswordLogInStrategy", () => {
let twoFactorService : MockProxy < TwoFactorService > ;
let authService : MockProxy < AuthService > ;
let policyService : MockProxy < PolicyService > ;
let passwordGeneration Service : MockProxy < PasswordGenerationService > ;
let passwordStrength Service : MockProxy < PasswordStrengthServiceAbstraction > ;
let passwordLogInStrategy : PasswordLogInStrategy ;
let credentials : PasswordLogInCredentials ;
@ -68,7 +71,7 @@ describe("PasswordLogInStrategy", () => {
@@ -68,7 +71,7 @@ describe("PasswordLogInStrategy", () => {
twoFactorService = mock < TwoFactorService > ( ) ;
authService = mock < AuthService > ( ) ;
policyService = mock < PolicyService > ( ) ;
passwordGeneration Service = mock < PasswordGeneration Service > ( ) ;
passwordStrength Service = mock < PasswordStrength Service > ( ) ;
appIdService . getAppId . mockResolvedValue ( deviceId ) ;
tokenService . decodeToken . mockResolvedValue ( { } ) ;
@ -94,7 +97,7 @@ describe("PasswordLogInStrategy", () => {
@@ -94,7 +97,7 @@ describe("PasswordLogInStrategy", () => {
logService ,
stateService ,
twoFactorService ,
passwordGeneration Service ,
passwordStrength Service ,
policyService ,
authService
) ;
@ -141,7 +144,7 @@ describe("PasswordLogInStrategy", () => {
@@ -141,7 +144,7 @@ describe("PasswordLogInStrategy", () => {
} ) ;
it ( "does not force the user to update their master password when it meets requirements" , async ( ) = > {
passwordGenerationService . p asswordStrength . mockReturnValue ( { score : 5 } as any ) ;
passwordStrengthService . getP asswordStrength . mockReturnValue ( { score : 5 } as any ) ;
policyService . evaluateMasterPassword . mockReturnValue ( true ) ;
const result = await passwordLogInStrategy . logIn ( credentials ) ;
@ -151,7 +154,7 @@ describe("PasswordLogInStrategy", () => {
@@ -151,7 +154,7 @@ describe("PasswordLogInStrategy", () => {
} ) ;
it ( "forces the user to update their master password on successful login when it does not meet master password policy requirements" , async ( ) = > {
passwordGenerationService . p asswordStrength . mockReturnValue ( { score : 0 } as any ) ;
passwordStrengthService . getP asswordStrength . mockReturnValue ( { score : 0 } as any ) ;
policyService . evaluateMasterPassword . mockReturnValue ( false ) ;
const result = await passwordLogInStrategy . logIn ( credentials ) ;
@ -164,7 +167,7 @@ describe("PasswordLogInStrategy", () => {
@@ -164,7 +167,7 @@ describe("PasswordLogInStrategy", () => {
} ) ;
it ( "forces the user to update their master password on successful 2FA login when it does not meet master password policy requirements" , async ( ) = > {
passwordGenerationService . p asswordStrength . mockReturnValue ( { score : 0 } as any ) ;
passwordStrengthService . getP asswordStrength . mockReturnValue ( { score : 0 } as any ) ;
policyService . evaluateMasterPassword . mockReturnValue ( false ) ;
const token2FAResponse = new IdentityTwoFactorResponse ( {