mirror of
https://github.com/flarum/framework.git
synced 2025-01-31 23:37:32 +08:00
Fix logout action
This commit is contained in:
parent
d2d5883a88
commit
0a746d4a5f
|
@ -1,16 +1,22 @@
|
|||
<?php namespace Flarum\Web\Actions;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Flarum\Web\Events\UserLoggedOut;
|
||||
use Cookie;
|
||||
|
||||
class LoginAction extends Action
|
||||
class LogoutAction extends Action
|
||||
{
|
||||
public function respond(Request $request, $params = [])
|
||||
public function handle(Request $request, $params = [])
|
||||
{
|
||||
Auth::user()->accessTokens()->delete();
|
||||
$user = $this->actor->getUser();
|
||||
|
||||
$this->event(new UserLoggedOut(Auth::user()));
|
||||
if ($user->exists) {
|
||||
$user->accessTokens()->delete();
|
||||
|
||||
return Redirect::to('')->withCookie($this->makeForgetCookie());
|
||||
event(new UserLoggedOut($user));
|
||||
}
|
||||
|
||||
return redirect('')->withCookie($this->makeForgetCookie());
|
||||
}
|
||||
|
||||
public function makeForgetCookie()
|
||||
|
|
Loading…
Reference in New Issue
Block a user