Skip to content

Commit de2aa81

Browse files
committed
Fix error on dashboard root when not logged in
1 parent 3bd7d21 commit de2aa81

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

templates/dashboard/index.html.twig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@
5757
}</code></pre>
5858
</div>
5959

60-
<h2 class="h5">Setup authentication</h2>
60+
{% if app.user %}
61+
<h2 class="h5">Setup authentication</h2>
6162

62-
<p>Store the authentication credentials in the global Composer <code>auth.json</code> with the command below.</p>
63+
<p>Store the authentication credentials in the global Composer <code>auth.json</code> with the command below.</p>
6364

64-
<div class="bg-body-secondary px-3 py-2 mb-3 rounded">
65-
<pre class="m-0"><code>composer config --global http-basic.{{ app.request.getHost() }} {{ app.user.username }} &lt;access-token&gt;</code></pre>
66-
</div>
65+
<div class="bg-body-secondary px-3 py-2 mb-3 rounded">
66+
<pre class="m-0"><code>composer config --global http-basic.{{ app.request.getHost() }} {{ app.user.username }} &lt;access-token&gt;</code></pre>
67+
</div>
68+
{% endif %}
6769
{% endblock %}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace CodedMonkey\Dirigent\Tests\FunctionalTests;
4+
5+
use CodedMonkey\Dirigent\Tests\PublicKernel;
6+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7+
8+
class DashboardRootControllerPublicTest extends WebTestCase
9+
{
10+
protected static function getKernelClass(): string
11+
{
12+
return PublicKernel::class;
13+
}
14+
15+
public function testIndex(): void
16+
{
17+
$client = static::createClient();
18+
19+
$client->request('GET', '/');
20+
21+
$this->assertResponseStatusCodeSame(200);
22+
23+
$this->assertAnySelectorTextSame('#total_packages .display-6', '1');
24+
}
25+
}

0 commit comments

Comments
 (0)