changed the logout page a bit

This commit is contained in:
flash 2016-09-13 16:41:42 +02:00
parent bb21046e73
commit 77fc40e6d8
5 changed files with 25 additions and 9 deletions

View file

@ -43,19 +43,16 @@ class AuthController extends Controller
*/ */
public function logout() public function logout()
{ {
if (!session_check('s')) { if (!session_check()) {
$message = 'Validation failed, this logout attempt was possibly forged.'; return view('auth/logout');
$redirect = $_REQUEST['redirect'] ?? route('main.index');
return view('global/information', compact('message', 'redirect'));
} }
// Destroy the active session // Destroy the active session
CurrentSession::stop(); CurrentSession::stop();
// Return true indicating a successful logout // Return true indicating a successful logout
$message = 'Goodbye!'; header('Location: ' . route('auth.login'));
$redirect = route('auth.login'); return;
return view('global/information', compact('message', 'redirect'));
} }
/** /**

View file

@ -0,0 +1,18 @@
{% extends 'master.twig' %}
{% set title = 'Logout' %}
{% block content %}
<div class="loginPage">
<div class="loginForm">
<div class="head">
Are you sure?
</div>
<form method="post" action="{{ route('auth.logout') }}" id="logoutForm">
<div class="centreAlign">
<button class="inputStyling" id="loginButton" name="session" value="{{ session_id() }}"><i class="fa fa-sign-out"></i> Logout</button>
</div>
</form>
</div>
</div>
{% endblock %}

View file

@ -53,7 +53,7 @@
<a class="menu-item fa-gavel" href="{{ route('manage.index') }}" title="Manage"></a> <a class="menu-item fa-gavel" href="{{ route('manage.index') }}" title="Manage"></a>
{% endif %} {% endif %}
<a class="menu-item fa-cogs" href="{{ route('settings.index') }}" title="Settings"></a> <a class="menu-item fa-cogs" href="{{ route('settings.index') }}" title="Settings"></a>
<a class="menu-item fa-sign-out" href="{{ route('auth.logout') }}?s={{ session_id() }}" title="Logout" id="headerLogoutLink"></a> <a class="menu-item fa-sign-out" href="{{ route('auth.logout') }}" title="Logout"></a>
{% else %} {% else %}
<a class="menu-item fa-magic" href="{{ route('auth.register') }}" title="Register"></a> <a class="menu-item fa-magic" href="{{ route('auth.register') }}" title="Register"></a>
<a class="menu-item fa-sign-in" href="{{ route('auth.login') }}" title="Login"></a> <a class="menu-item fa-sign-in" href="{{ route('auth.login') }}" title="Login"></a>

View file

@ -52,6 +52,7 @@ Routerv1::group(['before' => 'maintenance'], function () {
}); });
Routerv1::group(['before' => 'loginCheck'], function () { Routerv1::group(['before' => 'loginCheck'], function () {
Routerv1::get('/logout', 'AuthController@logout', 'auth.logout'); Routerv1::get('/logout', 'AuthController@logout', 'auth.logout');
Routerv1::post('/logout', 'AuthController@logout', 'auth.logout');
}); });
// Link compatibility layer, prolly remove this in like a year // Link compatibility layer, prolly remove this in like a year

View file

@ -94,7 +94,7 @@ if (!defined('IN_CLI')) {
// ->methods('GET') // ->methods('GET')
// ->action('faq') // ->action('faq')
// ->group( // ->group(
// Route::path('sub') // Route::path('sub/{meow}/{cock}?')
// ->methods(['GET', 'POST']) // ->methods(['GET', 'POST'])
// ->action('search') // ->action('search')
// ->name('main.search') // ->name('main.search')