mirror of
https://github.com/axeloz/filesharing.git
synced 2025-05-06 01:53:55 +02:00
Adding logout feature
This commit is contained in:
parent
51a8831b98
commit
3c0520711e
6 changed files with 25 additions and 6 deletions
|
@ -68,6 +68,12 @@ class Auth {
|
|||
|
||||
throw new Exception('Could not update user\'s details');
|
||||
}
|
||||
|
||||
static function logout() {
|
||||
if (self::isLogged()) {
|
||||
session()->invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,4 +96,9 @@ class WebController extends Controller
|
|||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function logout(Request $request) {
|
||||
Auth::logout();
|
||||
return redirect()->route('homepage');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,5 +85,6 @@ return [
|
|||
'duplicate-file' => 'This file already exists in the bundle',
|
||||
'unexpected-error' => 'An unexpected error has occurred',
|
||||
'login-to-get-bundles' => 'to get your bundles',
|
||||
'you-are-logged-in' => 'You are logged in as ":username"'
|
||||
'you-are-logged-in' => 'You are logged in as ":username"',
|
||||
'logout' => 'Logout'
|
||||
];
|
||||
|
|
|
@ -85,5 +85,6 @@ return [
|
|||
'duplicate-file' => 'Ce fichier existe déjà dans l\'archive',
|
||||
'unexpected-error' => 'Une erreur inattendue est survenue',
|
||||
'to-get-bundles' => 'pour accéder à vos archives',
|
||||
'you-are-logged-in' => 'Vous êtes connecté(e) en tant que ":username"'
|
||||
'you-are-logged-in' => 'Vous êtes connecté(e) en tant que ":username"',
|
||||
'logout' => 'Déconnexion'
|
||||
];
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<footer class="relative mt-5 h-6">
|
||||
<footer class="relative mt-5 h-6 text-xs">
|
||||
@if (App\Helpers\Auth::isLogged())
|
||||
<span class="ml-3 text-xs text-slate-600">
|
||||
<span class="ml-3 text-slate-600">
|
||||
@lang('app.you-are-logged-in', [
|
||||
'username' => App\Helpers\Auth::getLoggedUserDetails()['username']
|
||||
])
|
||||
</span>
|
||||
[<a href="{{ route('logout') }}" class="text-primary hover:underline">@lang('app.logout')</a>]
|
||||
|
||||
|
||||
@endif
|
||||
|
||||
<div class="absolute right-0 top-0 text-[.6rem] text-slate-100 text-right px-2 py-1 italic bg-primary rounded-tl-lg">
|
||||
|
|
|
@ -23,8 +23,11 @@ use App\Http\Middleware\UploadAccess;
|
|||
/**
|
||||
Public route for login
|
||||
*/
|
||||
Route::get('/login', [WebController::class, 'login']);
|
||||
Route::post('/login', [WebController::class, 'doLogin']);
|
||||
Route::controller(WebController::class)->group(function() {
|
||||
Route::get('/login', 'login');
|
||||
Route::post('/login', 'doLogin');
|
||||
Route::get('/logout', 'logout')->name('logout');
|
||||
});
|
||||
|
||||
/**
|
||||
Upload routes
|
||||
|
|
Loading…
Add table
Reference in a new issue