Demo notice

This commit is contained in:
Greg Shuflin 2025-02-03 16:01:34 -08:00
parent 4c44767301
commit 3ab595abd2
3 changed files with 12 additions and 22 deletions

View File

@ -12,7 +12,6 @@ mod user;
use rocket::fairing::{self, AdHoc};
use rocket::fs::FileServer;
use rocket::response::Redirect;
use rocket::State;
use rocket::{Build, Rocket};
use rocket_db_pools::{sqlx, Connection, Database};
use rocket_dyn_templates::{context, Template};
@ -59,8 +58,7 @@ async fn index_redirect(mut db: Connection<Db>) -> Redirect {
#[get("/login")]
fn login(demo_mode: &State<bool>) -> Template {
let demo_mode: bool = **demo_mode;
Template::render("login", context! { demo_mode: demo_mode })
Template::render("login", context! { demo_mode: *demo_mode })
}
// Run migrations and setup demo data if needed

View File

@ -537,7 +537,6 @@ button:disabled {
}
.demo-notice {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 4px;
padding: 1rem;
@ -545,19 +544,12 @@ button:disabled {
text-align: center;
}
.demo-notice h2 {
color: #0d6efd;
margin-top: 0;
margin-bottom: 1rem;
}
.demo-notice p {
margin: 0.5rem 0;
}
.demo-notice pre {
background-color: #e9ecef;
padding: 0.2rem 0.4rem;
border-radius: 3px;
padding: 0.1rem 0.4rem;
border-radius: 2px;
font-family: monospace;
}

View File

@ -7,17 +7,17 @@
<link rel="stylesheet" href="/static/css/style.css">
</head>
<div class="login-container">
{% if demo_mode %}
<div class="demo-notice">
<h2>Demo Mode</h2>
<p>RSS Reader is currently running in demo mode. You can log in with these credentials:</p>
<p>Username: <pre style="display: inline">demo</pre></p>
<p>Password: <pre style="display: inline">demo</pre></p>
<p>Note: Any data you create will not be persisted after the application restarts.</p>
</div>
{% endif %}
<form class="login-form" id="loginForm">
<h1>Login</h1>
{% if demo_mode %}
<div class="demo-notice">
<p>RSS Reader is currently running in demo mode. You can log in with these credentials:</p>
Username: <pre style="display: inline">demo</pre>, Password: <pre style="display: inline">demo</pre>
<p>Note: Any data you create will not be persisted after the application restarts.</p>
</div>
{% endif %}
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>