mirror of
https://github.com/flarum/core.git
synced 2025-10-12 07:24:27 +02:00
35 lines
666 B
PHP
35 lines
666 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* For detailed copyright and license information, please view the
|
|
* LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\Http;
|
|
|
|
use Illuminate\Contracts\Session\Session;
|
|
|
|
class SessionAuthenticator
|
|
{
|
|
/**
|
|
* @param Session $session
|
|
* @param int $userId
|
|
*/
|
|
public function logIn(Session $session, $userId)
|
|
{
|
|
$session->regenerate(true);
|
|
$session->put('user_id', $userId);
|
|
}
|
|
|
|
/**
|
|
* @param Session $session
|
|
*/
|
|
public function logOut(Session $session)
|
|
{
|
|
$session->invalidate();
|
|
$session->regenerateToken();
|
|
}
|
|
}
|