First web gui prototype

This commit is contained in:
2024-04-09 10:26:32 +02:00
parent 0b534fa727
commit 793eda4bc4
39 changed files with 6760 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
<?php
/******************************************************************************
* YMS - Yacht Management Software
* Copyright (C) 2024 Thomas Hooge
*
* SPDX-License-Identifier: WTFPL
******************************************************************************/
// TODO Code to handle page call with already logged on user
require 'globals.inc';
session_name(APP_SESSION);
session_start();
if (isset($_POST['login'])) {
$username = substr($_POST['username'], 0, 20);
$password = substr($_POST['password'], 0, 32);
if (!$user->login($username, $password)) {
$err = $user->get_last_error();
}
} else {
$username = '';
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<title><?=APP_TITLE_SHORT?> - Login</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/bootstrap-icons.min.css" rel="stylesheet">
<script src="bootstrap/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container">
<section class="mx-auto my-5" style="max-width:32rem;">
<div class="card card-form mt-2 mb-4">
<div class="card-header">
<?=APP_TITLE?>
</div>
<div class="row my-3">
<div class="col">
<img src="sailboat.svg" class="img-fluid rounded-start" alt="sailboat">
</div>
<div class="col">
<div class="card-body">
<h5 class="card-title"><?=sprintf(_('Login to %s'), APP_TITLE_SHORT)?></h5>
<form id="login" action="login.php" method="post">
<div class="mb-3 mt-3">
<label for="username" class="form-label"><?=_('Username:')?></label>
<input type="text" class="form-control" required autofocus size="20" maxlength="20" name="username" id="username" value="<?=$username?>">
</div>
<div class="mb-3 mt-3">
<label for="password" class="form-label"><?=_('Password:')?></label>
<input type="password" class="form-control" required size="20" maxlength="32" name="password" id="password">
</div>
<?php
if (isset($err)) {
echo '<div class="alert alert-danger alert-dismissible fade show role="alert"">';
echo '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>';
echo '<b>', _('Error'), ':</b> ', $err;
echo "</div>\n";
}
?>
<button type="submit" class="btn btn-primary" title="<?php printf(_('Logon to %s'), APP_TITLE_SHORT); ?>" name="login" value="1">
<span class="bi bi-caret-right"></span>
<?=_('Login')?>
</button>
</form>
</div> <!-- card body -->
</div>
</div>
</div>
</section>
</div>
</body>
</html>