config()->set('admin_access.secrets_key', 'base64:'.base64_encode(random_bytes(32)))); it('confirms a console password against the operator record, not a portal user', function () { $operator = Operator::factory()->role('Owner')->create(['password' => 'operator-passwort']); Livewire::actingAs($operator, 'operator')->test(Secrets::class) ->set('confirmablePassword', 'operator-passwort') ->call('confirmPassword') ->assertHasNoErrors(); }); it('rejects a password that belongs to a portal user with the same address', function () { // The trap: two tables, one address. Confirming against the wrong one would // let a customer's password unlock the console. $operator = Operator::factory()->role('Owner')->create([ 'email' => 'doppelt@clupilot.test', 'password' => 'operator-passwort', ]); User::factory()->create(['email' => 'doppelt@clupilot.test', 'password' => 'kunden-passwort']); Livewire::actingAs($operator, 'operator')->test(Secrets::class) ->set('confirmablePassword', 'kunden-passwort') ->call('confirmPassword') ->assertHasErrors('confirmablePassword'); }); it('still confirms a portal password on the web guard', function () { $user = User::factory()->create(['password' => 'kunden-passwort']); Livewire::actingAs($user)->test(App\Livewire\Settings::class) ->set('confirmablePassword', 'kunden-passwort') ->call('confirmPassword') ->assertHasNoErrors(); });