Adds login and registration messages and configs

main
Yasen Pramatarov 2024-08-01 11:12:54 +03:00
parent 06ffde67f4
commit 5d240b1dd8
3 changed files with 45 additions and 29 deletions

View File

@ -5,6 +5,8 @@ $config = [
'folder' => '/jilo-web/', 'folder' => '/jilo-web/',
'database' => '/home/yasen/work/code/git/lindeas-code/jilo-web/jilo-web.db', 'database' => '/home/yasen/work/code/git/lindeas-code/jilo-web/jilo-web.db',
'jilo_database' => '/home/yasen/work/code/git/lindeas-code/jilo/jilo.db', 'jilo_database' => '/home/yasen/work/code/git/lindeas-code/jilo/jilo.db',
'registration_enabled' => true,
'login_message' => '',
'version' => '0.1.1', 'version' => '0.1.1',
]; ];

View File

@ -68,6 +68,11 @@ try {
$error = $e->getMessage(); $error = $e->getMessage();
} }
if (!empty($config['login_message'])) {
$notice = $config['login_message'];
include 'templates/block-message.php';
}
include 'templates/form-login.php'; include 'templates/form-login.php';
?> ?>

View File

@ -1,10 +1,13 @@
<?php <?php
require_once 'classes/database.php'; // registration is allowed, go on
require 'classes/user.php'; if ($config['registration_enabled'] === true) {
unset($error);
try { require_once 'classes/database.php';
require 'classes/user.php';
unset($error);
try {
$db = new Database($config['database']); $db = new Database($config['database']);
$user = new User($db); $user = new User($db);
@ -24,11 +27,17 @@ try {
exit(); exit();
} }
} }
} catch (Exception $e) { } catch (Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
}
include 'templates/block-message.php';
include 'templates/form-register.php';
// registration disabled
} else {
$notice = 'Registration is disabled';
include 'templates/block-message.php';
} }
include 'templates/block-message.php';
include 'templates/form-register.php';
?> ?>