85 lines
3.0 KiB
PHP
85 lines
3.0 KiB
PHP
<?php
|
|
/******************************************************************************
|
|
* YMS - Yacht Management Software
|
|
* Copyright (C) 2024-2026 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>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
});
|
|
</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="<?=APP_ILLUSTRATION?>" 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> <?php /* card body */?>
|
|
</div> <?php /* columns */?>
|
|
</div> <?php /* rows */?>
|
|
</div> <?phph /* card */?>
|
|
</section>
|
|
</div>
|
|
</body>
|
|
</html>
|