summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-10-08 15:23:46 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2019-10-08 15:28:23 +0200
commit8f8130634e40f6a24295b7bab449a43ed7c5aa80 (patch)
treee21366eeba1193c06371b6a508a19570c24aa021
parent810068dcf811b17805ee9958b877a827bf8125ed (diff)
Show normal login page after registration, added msg() template function
-rw-r--r--includes/pages/guest_login.php4
-rw-r--r--includes/view/User_view.php58
-rw-r--r--resources/views/pages/login.twig1
-rw-r--r--src/Renderer/Twig/Extensions/Legacy.php1
-rw-r--r--tests/Unit/Renderer/Twig/Extensions/LegacyTest.php1
5 files changed, 18 insertions, 47 deletions
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index 280743e5..170572e4 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -242,9 +242,9 @@ function guest_register()
redirect(page_link_to('register'));
}
- // If a welcome message is present, display registration success page.
+ // If a welcome message is present, display it on the next page
if ($message = $config->get('welcome_msg')) {
- return User_registration_success_view($message);
+ info((new Parsedown())->text($message));
}
redirect(page_link_to('/'));
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index bfe7e02c..b38a5062 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -108,46 +108,6 @@ function User_settings_view(
}
/**
- * Displays the welcome message to the user and shows a login form.
- *
- * @param string $event_welcome_message
- * @return string
- */
-function User_registration_success_view($event_welcome_message)
-{
- $parsedown = new Parsedown();
- $event_welcome_message = $parsedown->text($event_welcome_message);
-
- return page_with_title(__('Registration successful'), [
- msg(),
- div('row', [
- div('col-md-4', [
- $event_welcome_message
- ]),
- div('col-md-4', [
- '<h2>' . __('Login') . '</h2>',
- form([
- form_text('login', __('Nick'), ''),
- form_password('password', __('Password')),
- form_submit('submit', __('Login')),
- buttons([
- button(page_link_to('user_password_recovery'), __('I forgot my password'))
- ]),
- info(__('Please note: You have to activate cookies!'), true)
- ], page_link_to('login'))
- ]),
- div('col-md-4', [
- '<h2>' . __('What can I do?') . '</h2>',
- '<p>' . __('Please read about the jobs you can do to help us.') . '</p>',
- buttons([
- button(page_link_to('angeltypes', ['action' => 'about']), __('Teams/Job description') . ' &raquo;')
- ])
- ])
- ])
- ]);
-}
-
-/**
* Gui for deleting user with password field.
*
* @param User $user
@@ -255,13 +215,13 @@ function Users_view(
];
$user_table_headers = [
- 'name' => Users_table_header_link('name', __('Nick'), $order_by)
+ 'name' => Users_table_header_link('name', __('Nick'), $order_by)
];
- if(config('enable_user_name')) {
+ if (config('enable_user_name')) {
$user_table_headers['first_name'] = Users_table_header_link('first_name', __('Prename'), $order_by);
$user_table_headers['last_name'] = Users_table_header_link('last_name', __('Name'), $order_by);
}
- if(config('enable_dect')) {
+ if (config('enable_dect')) {
$user_table_headers['dect'] = Users_table_header_link('dect', __('DECT'), $order_by);
}
$user_table_headers['arrived'] = Users_table_header_link('arrived', __('Arrived'), $order_by);
@@ -271,8 +231,16 @@ function Users_view(
$user_table_headers['force_active'] = Users_table_header_link('force_active', __('Forced'), $order_by);
$user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('T-Shirt'), $order_by);
$user_table_headers['shirt_size'] = Users_table_header_link('shirt_size', __('Size'), $order_by);
- $user_table_headers['arrival_date'] = Users_table_header_link('planned_arrival_date', __('Planned arrival'), $order_by);
- $user_table_headers['departure_date'] = Users_table_header_link('planned_departure_date', __('Planned departure'), $order_by);
+ $user_table_headers['arrival_date'] = Users_table_header_link(
+ 'planned_arrival_date',
+ __('Planned arrival'),
+ $order_by
+ );
+ $user_table_headers['departure_date'] = Users_table_header_link(
+ 'planned_departure_date',
+ __('Planned departure'),
+ $order_by
+ );
$user_table_headers['last_login_at'] = Users_table_header_link('last_login_at', __('Last login'), $order_by);
$user_table_headers['actions'] = '';
diff --git a/resources/views/pages/login.twig b/resources/views/pages/login.twig
index 88326429..6160508f 100644
--- a/resources/views/pages/login.twig
+++ b/resources/views/pages/login.twig
@@ -32,6 +32,7 @@
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<div class="panel panel-primary first">
<div class="panel-body">
+ {{ msg() }}
{% for message in errors|default([]) %}
{{ m.alert(__(message), 'danger') }}
{% endfor %}
diff --git a/src/Renderer/Twig/Extensions/Legacy.php b/src/Renderer/Twig/Extensions/Legacy.php
index 79de32cb..55c095fc 100644
--- a/src/Renderer/Twig/Extensions/Legacy.php
+++ b/src/Renderer/Twig/Extensions/Legacy.php
@@ -32,6 +32,7 @@ class Legacy extends TwigExtension
new TwigFunction('menuUserHints', 'header_render_hints', $isSafeHtml),
new TwigFunction('menuUserSubmenu', 'make_user_submenu', $isSafeHtml),
new TwigFunction('page', [$this, 'getPage']),
+ new TwigFunction('msg', 'msg', $isSafeHtml),
];
}
diff --git a/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php b/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php
index b6c19d14..7190c979 100644
--- a/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php
+++ b/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php
@@ -26,6 +26,7 @@ class LegacyTest extends ExtensionTest
$this->assertExtensionExists('menuUserHints', 'header_render_hints', $functions, $isSafeHtml);
$this->assertExtensionExists('menuUserSubmenu', 'make_user_submenu', $functions, $isSafeHtml);
$this->assertExtensionExists('page', [$extension, 'getPage'], $functions);
+ $this->assertExtensionExists('msg', 'msg', $functions, $isSafeHtml);
}
/**