fix: validate dossier scope and accurate directory MFA status
This commit is contained in:
@@ -190,9 +190,13 @@ final class OpportunityPromotionTest extends TestCase
|
||||
public function test_profile_directory_uses_existing_accounts_without_exposing_authentication_secrets(): void
|
||||
{
|
||||
$other = User::factory()->create();
|
||||
$missingSecret = User::factory()->create(['two_factor_secret' => null, 'two_factor_confirmed_at' => now()]);
|
||||
$unconfirmed = User::factory()->create(['two_factor_secret' => Crypt::encryptString('SYNTHETIC-QA'), 'two_factor_confirmed_at' => null]);
|
||||
DB::table('portal_superuser_pair')->updateOrInsert(['id' => 1], ['first_user_id' => $this->actor->id, 'second_user_id' => $other->id, 'approved_by' => $other->id]);
|
||||
$this->get('/perfis/gestao')->assertOk()->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->has('staffAccounts')->where('staffAccounts', fn ($rows) => collect($rows)->contains(fn ($row) => $row['id'] === $this->actor->id && $row['email'] === $this->actor->email && $row['verified'] && $row['mfa'])
|
||||
&& collect($rows)->contains(fn ($row) => $row['id'] === $missingSecret->id && $row['mfa'] === false)
|
||||
&& collect($rows)->contains(fn ($row) => $row['id'] === $unconfirmed->id && $row['mfa'] === false)
|
||||
&& collect($rows)->every(fn ($row) => ! isset($row['password']) && ! isset($row['two_factor_secret']))));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user