Merge branch 'main' of gitlab.com:PhilippHofer/rot

This commit is contained in:
Philipp 2023-07-22 15:51:42 +02:00
commit f0f5f6f357
3 changed files with 14 additions and 5 deletions

View File

@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS "log" (
CREATE TABLE IF NOT EXISTS "location" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL
"name" text NOT NULL UNIQUE
);
CREATE TABLE IF NOT EXISTS "boat" (
@ -85,7 +85,7 @@ CREATE TABLE IF NOT EXISTS "boat" (
CREATE TABLE IF NOT EXISTS "logbook_type" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL -- e.g. 'Wanderfahrt', 'Regatta'
"name" text NOT NULL UNIQUE -- e.g. 'Wanderfahrt', 'Regatta'
);
CREATE TABLE IF NOT EXISTS "logbook" (

View File

@ -18,14 +18,18 @@ use crate::model::{
user::{LoginError, User},
};
#[get("/")]
fn index(flash: Option<FlashMessage<'_>>) -> Template {
#[get("/?<name>")]
fn index(flash: Option<FlashMessage<'_>>, name: Option<String>) -> Template {
let mut context = tera::Context::new();
if let Some(msg) = flash {
context.insert("flash", &msg.into_inner());
}
if let Some(n) = name {
context.insert("name", &n);
}
Template::render("auth/login", context.into_json())
}

View File

@ -14,7 +14,12 @@
<input type="hidden" name="remember" value="true">
<div class="-space-y-px rounded-md shadow-sm">
<div>
{% if name %}
{{ macros::input(label='Name', name='name', type='input', required=true, class='rounded-t-md',hide_label=true,value=name) }}
{% else %}
{{ macros::input(label='Name', name='name', type='input', required=true, class='rounded-t-md',hide_label=true) }}
{% endif %}
</div>
<div>
{{ macros::input(label='Passwort', name='password', type='password', class='rounded-b-md',hide_label=true) }}