d489716c9b
This commit introduces the foundation for web-based authentication and user interface. It includes: - **Session Management**: Securely handling user sessions using cryptographically generated tokens, cookies with appropriate security flags, and server-side storage. - **Login/Logout Functionality**: Endpoints for users to log in with their credentials and log out, clearing their session. - **User Interface**: Basic templates for the login page, a list of cases, and a detailed view of a single case, allowing users to navigate and view their data. - **Authorization**: An `AuthenticatedWebUser` extractor to ensure only logged-in users can access protected web routes. - **Configuration**: Added a `cookie_secure` option to the configuration to control the `Secure` flag on session cookies, useful for local development. - **Dependencies**: Added necessary dependencies for password hashing, time handling, and TOML file manipulation. - **Helper Binary**: Included a `hash-password` binary to simplify generating bcrypt hashes for user passwords.
29 lines
895 B
HTML
29 lines
895 B
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Doctate — Login</title>
|
|
<style>
|
|
body { font-family: sans-serif; max-width: 400px; margin: 4em auto; padding: 0 1em; }
|
|
h1 { font-size: 1.3em; }
|
|
form { display: flex; flex-direction: column; gap: 0.7em; }
|
|
input { padding: 0.5em; font-size: 1em; }
|
|
button { padding: 0.6em; font-size: 1em; cursor: pointer; }
|
|
.error { background: #fee; border: 1px solid #e99; padding: 0.5em; border-radius: 4px; color: #900; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Doctate Login</h1>
|
|
{% match error %}
|
|
{% when Some with (msg) %}
|
|
<div class="error">{{ msg }}</div>
|
|
{% when None %}
|
|
{% endmatch %}
|
|
<form method="post" action="/web/login">
|
|
<label>Benutzer (slug)<input type="text" name="slug" autofocus required></label>
|
|
<label>Passwort<input type="password" name="password" required></label>
|
|
<button type="submit">Anmelden</button>
|
|
</form>
|
|
</body>
|
|
</html>
|