Add register form validation

This commit is contained in:
Jay Trees 2022-01-17 12:17:05 +01:00
parent 8dacaeb59c
commit fa65606d2a
3 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,9 @@
$(function() {
$('.ui.form').form({
on: 'blur',
fields: {
email: 'email',
password: ['minLength[6]', 'empty'],
}
});
});

View file

@ -89,6 +89,15 @@ class Page
$scriptDefault = 'includes/assets/js/default.js';
$scriptDefaultModified = filemtime($scriptDefault);
echo '<script defer src="' . $scriptDefault . '?m=' . $scriptDefaultModified . '"></script>';
/** Page */
$scriptPage = 'includes/assets/js/' . $this->name . '.js';
if (file_exists($scriptPage)) {
$scriptPageModified = filemtime($scriptPage);
echo '<script defer src="' . $scriptPage . '?m=' . $scriptPageModified . '"></script>';
}
?>
<title><?= $this->title ?> - wishthis</title>

View file

@ -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();
<input type="password" name="password" />
</div>
<div class="ui error message"></div>
<input class="ui primary button" type="submit" value="Register" />
</form>
</div>