rework session deduplication

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-10-16 17:37:13 +02:00
parent 9d4c591f1a
commit 3118ecf385
7 changed files with 40 additions and 29 deletions

View file

@ -3,6 +3,8 @@
namespace AIO\Auth;
use AIO\Data\ConfigurationManager;
use AIO\Data\DataConst;
use \DateTime;
class AuthManager {
private const SESSION_KEY = 'aio_authenticated';
@ -21,6 +23,14 @@ class AuthManager {
}
public function SetAuthState(bool $isLoggedIn) : void {
if (!$this->IsAuthenticated() && $isLoggedIn === true) {
$date = new DateTime();
$dateTime = $date->getTimestamp();
$_SESSION['date_time'] = $dateTime;
file_put_contents(DataConst::GetSessionDateFile(), (string)$dateTime);
}
$_SESSION[self::SESSION_KEY] = $isLoggedIn;
}