20 lines
469 B
PHP
20 lines
469 B
PHP
<?php
|
|
|
|
use MintyPHP\Service\Auth\AuthService;
|
|
use MintyPHP\Support\Flash;
|
|
use MintyPHP\Router;
|
|
|
|
if (!empty($_SESSION['user']['id'])) {
|
|
if (Flash::has()) {
|
|
Flash::keep();
|
|
}
|
|
Router::redirect("admin");
|
|
}
|
|
|
|
if (isset($_POST['email'])) {
|
|
$email = trim((string) ($_POST['email'] ?? ''));
|
|
$password = (string) ($_POST['password'] ?? '');
|
|
$remember = !empty($_POST['remember']);
|
|
AuthService::loginAndRedirect($email, $password, 'admin', 'login', $remember);
|
|
}
|