Added login/register message partials for easier use via theme system

Related to #608
This commit is contained in:
Dan Brown 2022-11-12 09:02:33 +00:00
parent 2fa5c2581c
commit d2cd33e226
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
5 changed files with 25 additions and 0 deletions

View file

@ -9,6 +9,8 @@
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ Str::title(trans('auth.log_in')) }}</h1>
@include('auth.parts.login-message')
@include('auth.parts.login-form-' . $authMethod)
@if(count($socialDrivers) > 0)

View file

@ -0,0 +1,2 @@
{{-- This is a placeholder template file provided as a --}}
{{-- convenience to users of the visual theme system. --}}

View file

@ -0,0 +1,2 @@
{{-- This is a placeholder template file provided as a --}}
{{-- convenience to users of the visual theme system. --}}

View file

@ -8,6 +8,8 @@
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ Str::title(trans('auth.sign_up')) }}</h1>
@include('auth.parts.register-message')
<form action="{{ url("/register") }}" method="POST" class="mt-l stretch-inputs">
{!! csrf_field() !!}

View file

@ -338,6 +338,23 @@ class ThemeTest extends TestCase
});
}
public function test_login_and_register_message_template_files_can_be_used()
{
$loginMessage = 'Welcome to this instance, login below you scallywag';
$registerMessage = 'You want to register? Enter the deets below you numpty';
$this->usingThemeFolder(function (string $folder) use ($loginMessage, $registerMessage) {
$viewDir = theme_path('auth/parts');
mkdir($viewDir, 0777, true);
file_put_contents($viewDir . '/login-message.blade.php', $loginMessage);
file_put_contents($viewDir . '/register-message.blade.php', $registerMessage);
$this->setSettings(['registration-enabled' => 'true']);
$this->get('/login')->assertSee($loginMessage);
$this->get('/register')->assertSee($registerMessage);
});
}
protected function usingThemeFolder(callable $callback)
{
// Create a folder and configure a theme