All checks were successful
Build and push / Pulling repo on server (push) Successful in 19s
57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?php
|
|
|
|
class Login extends Page {
|
|
|
|
function setMenu()
|
|
{
|
|
if($_SESSION['user'])
|
|
$this->menu_text = $_SESSION['userid'];
|
|
else
|
|
$this->menu_text = 'Login';
|
|
$this->menu_image = 'far fa-user';
|
|
$this->menu_priority = 99;
|
|
}
|
|
|
|
function setSubmenu()
|
|
{
|
|
if($_SESSION['user'])
|
|
{
|
|
$this->addSubmenuItem('Settings', '/settings', 'fas fa-cog');
|
|
$this->addSubmenuItem('Logout', '/login/logout', 'fas fa-sign-out-alt', 'bg-red-500');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function index()
|
|
{
|
|
$this->set('hello','world');
|
|
$this->set('template', 'login.html');
|
|
//return print_r($_REQUEST, true);
|
|
}
|
|
|
|
function test()
|
|
{
|
|
return nl2br(print_r([
|
|
'uuid' => gen_ulid(),
|
|
'timestamp' => ulid_to_timestamp("01HD9XN98F8SGT01X527KBNHRN"),
|
|
'freshtime' => ulid_to_timestamp(gen_ulid())
|
|
],true));
|
|
}
|
|
|
|
function logout()
|
|
{
|
|
session_destroy();
|
|
$this->redirect('/');
|
|
}
|
|
|
|
function validate()
|
|
{
|
|
$email = $_REQUEST['email'];
|
|
$password = $_REQUEST['password'];
|
|
$remember = $_REQUEST['remember'];
|
|
|
|
return print_r(['email'=>$email,'password'=>$password,'remember'=>$remember], true);
|
|
}
|
|
|
|
} |