add UI rows for auth pages
This commit is contained in:
parent
95fed10535
commit
1e85794256
|
|
@ -29,7 +29,16 @@ class AuthController extends Controller
|
|||
$ip = $whip->getValidIpAddress();
|
||||
$ip = $filter->apply('client_ip', $ip);
|
||||
|
||||
$rows = [
|
||||
'auth.rows.login.notice',
|
||||
'auth.rows.login.message',
|
||||
'auth.rows.login.form',
|
||||
'auth.rows.login.registration-link',
|
||||
];
|
||||
$rows = $filter->apply('auth_page_rows:login', $rows);
|
||||
|
||||
return view('auth.login', [
|
||||
'rows' => $rows,
|
||||
'extra' => [
|
||||
'tooManyFails' => cache(sha1('login_fails_'.$ip)) > 3,
|
||||
'recaptcha' => option('recaptcha_sitekey'),
|
||||
|
|
@ -120,11 +129,18 @@ class AuthController extends Controller
|
|||
return json(trans('auth.logout.success'), 0);
|
||||
}
|
||||
|
||||
public function register()
|
||||
public function register(Filter $filter)
|
||||
{
|
||||
$rows = [
|
||||
'auth.rows.register.notice',
|
||||
'auth.rows.register.form',
|
||||
];
|
||||
$rows = $filter->apply('auth_page_rows:register', $rows);
|
||||
|
||||
if (option('user_can_register')) {
|
||||
return view('auth.register', [
|
||||
'site_name' => option_localized('site_name'),
|
||||
'rows' => $rows,
|
||||
'extra' => [
|
||||
'player' => (bool) option('register_with_player_name'),
|
||||
'recaptcha' => option('recaptcha_sitekey'),
|
||||
|
|
|
|||
|
|
@ -3,18 +3,9 @@
|
|||
{% block title %}{{ trans('auth.login.title') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p class="login-box-msg">{{ trans('auth.login.message') }}</p>
|
||||
{% if session_has('msg') %}
|
||||
<div class="alert alert-warning">
|
||||
{{ session_pull('msg') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<main></main>
|
||||
<br>
|
||||
{{ include('auth.oauth') }}
|
||||
<div>
|
||||
<a href="{{ url('auth/register') }}">{{ trans('auth.register-link') }}</a>
|
||||
</div>
|
||||
{% for row in rows %}
|
||||
{{ include(row) }}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block before_foot %}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@
|
|||
{% block title %}{{ trans('auth.register.title') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p class="login-box-msg">
|
||||
{{ trans('auth.register.message', {sitename: site_name}) }}
|
||||
</p>
|
||||
<main></main>
|
||||
{{ include('auth.oauth') }}
|
||||
{% for row in rows %}
|
||||
{{ include(row) }}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block before_foot %}
|
||||
|
|
|
|||
1
resources/views/auth/rows/login/form.twig
Normal file
1
resources/views/auth/rows/login/form.twig
Normal file
|
|
@ -0,0 +1 @@
|
|||
<main></main>
|
||||
5
resources/views/auth/rows/login/message.twig
Normal file
5
resources/views/auth/rows/login/message.twig
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{% if session_has('msg') %}
|
||||
<div class="alert alert-warning">
|
||||
{{ session_pull('msg') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
1
resources/views/auth/rows/login/notice.twig
Normal file
1
resources/views/auth/rows/login/notice.twig
Normal file
|
|
@ -0,0 +1 @@
|
|||
<p class="login-box-msg">{{ trans('auth.login.message') }}</p>
|
||||
3
resources/views/auth/rows/login/registration-link.twig
Normal file
3
resources/views/auth/rows/login/registration-link.twig
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="mt-3">
|
||||
<a href="{{ url('auth/register') }}">{{ trans('auth.register-link') }}</a>
|
||||
</div>
|
||||
1
resources/views/auth/rows/register/form.twig
Normal file
1
resources/views/auth/rows/register/form.twig
Normal file
|
|
@ -0,0 +1 @@
|
|||
<main></main>
|
||||
3
resources/views/auth/rows/register/notice.twig
Normal file
3
resources/views/auth/rows/register/notice.twig
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<p class="login-box-msg">
|
||||
{{ trans('auth.register.message', {sitename: site_name}) }}
|
||||
</p>
|
||||
|
|
@ -37,7 +37,10 @@ class AuthControllerTest extends TestCase
|
|||
|
||||
public function testLogin()
|
||||
{
|
||||
$filter = Fakes\Filter::fake();
|
||||
|
||||
$this->get('/auth/login')->assertSee('Log in');
|
||||
$filter->assertApplied('auth_page_rows:login');
|
||||
}
|
||||
|
||||
public function testHandleLogin()
|
||||
|
|
@ -239,7 +242,10 @@ class AuthControllerTest extends TestCase
|
|||
|
||||
public function testRegister()
|
||||
{
|
||||
$filter = Fakes\Filter::fake();
|
||||
|
||||
$this->get('/auth/register')->assertSee('Register');
|
||||
$filter->assertApplied('auth_page_rows:register');
|
||||
|
||||
option(['user_can_register' => false]);
|
||||
$this->get('/auth/register')->assertSee(trans('auth.register.close'));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user