coming together
All checks were successful
Build and push / Pulling repo on server (push) Successful in 24s

This commit is contained in:
Chris 2023-10-21 21:30:20 +02:00
parent bf101b3b26
commit 927d498d4a
7 changed files with 20 additions and 9 deletions

View File

@ -105,7 +105,8 @@ class Page
//render template by running include
ob_start();
extract($this->variables);
include($templatefile);
if($templatefile!= '')
include($templatefile);
$pagecontent = ob_get_contents();
ob_end_clean();

View File

@ -168,3 +168,8 @@ function gen_uuid() {
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
function escape($str)
{
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
}

View File

@ -5,7 +5,7 @@ class Err extends Page {
function notfound($params)
{
$this->set("page",$params[0]);
$this->set('template', "notfound.mustache");
$this->set('template', "notfound.html");
}
function notallowed()
@ -13,8 +13,4 @@ class Err extends Page {
return json_encode(['error'=>'not allowed']);
}
function maySeeThisPage()
{
return true;
}
}

View File

@ -1,4 +1,4 @@
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4" role="alert">
<p class="font-bold">404 - Not found</p>
<p>I have no memory of {{page}}</p>
<p>I have no memory of <?= escape($page) ?></p>
</div>

View File

@ -9,4 +9,13 @@ class Login extends Page {
//return print_r($_REQUEST, true);
}
function validate()
{
$email = $_REQUEST['email'];
$password = $_REQUEST['password'];
$remember = $_REQUEST['remember'];
return print_r(['email'=>$email,'password'=>$password,'remember'=>$remember], true);
}
}

View File

@ -7,7 +7,7 @@
<div id="response" class="text-gray-900 dark:text-white">
<?= $hello ?>
</div>
<form class="space-y-4 md:space-y-6" hx-post="/auth/login" hx-target="#response">
<form class="space-y-4 md:space-y-6" hx-post="/login/validate" hx-target="#response">
<div>
<label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your email</label>
<input type="email" name="email" id="email" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="name@company.com" required="">

View File

@ -29,7 +29,7 @@
</button>
</div>
<div class="hidden lg:flex lg:gap-x-12">
<a href="#" hx-get="/templates/product.html" hx-push-url="/product" hx-target="#main" class="text-sm font-semibold leading-6 text-gray-900">Product</a>
<a href="#" hx-get="/templates/product.html" hx-target="#main" class="text-sm font-semibold leading-6 text-gray-900">Product</a>
<a href="#" hx-get="/features" hx-push-url="/features" hx-target="#main" class="text-sm font-semibold leading-6 text-gray-900">Features</a>
</div>
<div class="hidden lg:flex lg:flex-1 lg:justify-end">