venom/src/Venom/Admin/Routes/LoginRoute.php

30 lines
563 B
PHP
Raw Normal View History

2020-09-25 21:33:54 +02:00
<?php
namespace Venom\Admin\Routes;
2020-09-25 22:33:35 +02:00
use Venom\Core\ArgumentHandler;
2020-09-25 21:33:54 +02:00
use Venom\Routing\Route;
2020-09-25 22:33:35 +02:00
use Venom\Security\Security;
2020-09-25 21:33:54 +02:00
class LoginRoute implements Route
{
2020-09-25 22:33:35 +02:00
public function login(): bool
{
Security::get()->login();
return true;
}
public function handle($fnc): bool
{
if ($fnc === 'logout') {
Security::get()->logout();
$url = ArgumentHandler::get()->getPostItem('REDIRECT_TO', '/admin/');
header('Location: ' . $url);
die();
}
2020-09-25 21:33:54 +02:00
return true;
}
}