Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(auth): allow restricted accounts to confirm passwords for passkeys

Andras Bacsai2fa4d06ed6ac
diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php
index afe1631a19..95442ca359 100644
--- a/bootstrap/helpers/subscriptions.php
+++ b/bootstrap/helpers/subscriptions.php
@@ -86,6 +86,7 @@ function allowedPathsForUnsubscribedAccounts()
'profile',
'profile/appearance',
'profile/passkeys/confirm',
+ 'user/confirm-password',
'user/passkeys',
'user/passkeys/options',
'passkeys/confirm',
diff --git a/tests/Feature/Auth/PasskeyAccessTest.php b/tests/Feature/Auth/PasskeyAccessTest.php
index 2f11771a09..8d2a9d5fca 100644
--- a/tests/Feature/Auth/PasskeyAccessTest.php
+++ b/tests/Feature/Auth/PasskeyAccessTest.php
@@ -61,6 +61,26 @@ it('asks for the password before the add passkey form opens', function () {
->assertSessionHas('status', 'passkey-add');
});
+it('lets restricted accounts confirm their password before adding a passkey', function (bool $selfHosted) {
+ config()->set('constants.coolify.self_hosted', $selfHosted);
+ $this->team->update(['show_boarding' => true]);
+ $this->actingAs($this->user)->withSession(['currentTeam' => $this->team]);
+
+ $this->get(route('profile.passkeys.confirm'))->assertRedirect(route('password.confirm'));
+ $this->get(route('password.confirm'))->assertOk();
+ $this->post(route('password.confirm.store'), ['password' => 'wrong-password'])
+ ->assertSessionHasErrors('password');
+ expect(session('auth.password_confirmed_at'))->toBeNull();
+
+ $this->post(route('password.confirm.store'), ['password' => 'password'])
+ ->assertRedirect(route('profile.passkeys.confirm'));
+ expect(session('auth.password_confirmed_at'))->toBeInt();
+ $this->get(route('profile.passkeys.confirm'))
+ ->assertRedirect(route('profile'))
+ ->assertSessionHas('status', 'passkey-add');
+ $this->getJson(route('passkey.registration-options'))->assertOk();
+})->with(['onboarding' => true, 'cloud without a subscription' => false]);
+
it('records audit events for passkey changes', function (string $eventClass, string $auditName) {
$passkey = $this->user->passkeys()->create([
'name' => 'Laptop',