From fa65606d2aaf1c3a0b343b622320b6bf938853d6 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Mon, 17 Jan 2022 12:17:05 +0100 Subject: [PATCH] Add register form validation --- includes/assets/js/register.js | 9 +++++++++ includes/classes/page.php | 9 +++++++++ includes/pages/register.php | 4 +++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 includes/assets/js/register.js diff --git a/includes/assets/js/register.js b/includes/assets/js/register.js new file mode 100644 index 00000000..d8299875 --- /dev/null +++ b/includes/assets/js/register.js @@ -0,0 +1,9 @@ +$(function() { + $('.ui.form').form({ + on: 'blur', + fields: { + email: 'email', + password: ['minLength[6]', 'empty'], + } + }); +}); diff --git a/includes/classes/page.php b/includes/classes/page.php index 694f234a..feb29e55 100644 --- a/includes/classes/page.php +++ b/includes/classes/page.php @@ -89,6 +89,15 @@ class Page $scriptDefault = 'includes/assets/js/default.js'; $scriptDefaultModified = filemtime($scriptDefault); echo ''; + + /** Page */ + $scriptPage = 'includes/assets/js/' . $this->name . '.js'; + + if (file_exists($scriptPage)) { + $scriptPageModified = filemtime($scriptPage); + + echo ''; + } ?> <?= $this->title ?> - wishthis diff --git a/includes/pages/register.php b/includes/pages/register.php index 5167940f..a65dd05d 100644 --- a/includes/pages/register.php +++ b/includes/pages/register.php @@ -16,7 +16,7 @@ if (isset($_POST['email'], $_POST['password'])) { ("' . $_POST['email'] . '", "' . sha1($_POST['password']) . '") ;'); - header('Location: ?page=login'); + header('Location: /?page=login'); die(); } @@ -38,6 +38,8 @@ $page->navigation(); +
+