add db constraints; add optional name for login (to be sent to members)
This commit is contained in:
parent
524d1acee2
commit
0381465272
@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS "log" (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "location" (
|
CREATE TABLE IF NOT EXISTS "location" (
|
||||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
"name" text NOT NULL
|
"name" text NOT NULL UNIQUE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "boat" (
|
CREATE TABLE IF NOT EXISTS "boat" (
|
||||||
@ -85,7 +85,7 @@ CREATE TABLE IF NOT EXISTS "boat" (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "logbook_type" (
|
CREATE TABLE IF NOT EXISTS "logbook_type" (
|
||||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
"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" (
|
CREATE TABLE IF NOT EXISTS "logbook" (
|
||||||
|
@ -18,14 +18,18 @@ use crate::model::{
|
|||||||
user::{LoginError, User},
|
user::{LoginError, User},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/?<name>")]
|
||||||
fn index(flash: Option<FlashMessage<'_>>) -> Template {
|
fn index(flash: Option<FlashMessage<'_>>, name: Option<String>) -> Template {
|
||||||
let mut context = tera::Context::new();
|
let mut context = tera::Context::new();
|
||||||
|
|
||||||
if let Some(msg) = flash {
|
if let Some(msg) = flash {
|
||||||
context.insert("flash", &msg.into_inner());
|
context.insert("flash", &msg.into_inner());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(n) = name {
|
||||||
|
context.insert("name", &n);
|
||||||
|
}
|
||||||
|
|
||||||
Template::render("auth/login", context.into_json())
|
Template::render("auth/login", context.into_json())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,12 @@
|
|||||||
<input type="hidden" name="remember" value="true">
|
<input type="hidden" name="remember" value="true">
|
||||||
<div class="-space-y-px rounded-md shadow-sm">
|
<div class="-space-y-px rounded-md shadow-sm">
|
||||||
<div>
|
<div>
|
||||||
{{ macros::input(label='Name', name='name', type='input', required=true, class='rounded-t-md',hide_label=true) }}
|
{% 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>
|
||||||
<div>
|
<div>
|
||||||
{{ macros::input(label='Passwort', name='password', type='password', class='rounded-b-md',hide_label=true) }}
|
{{ macros::input(label='Passwort', name='password', type='password', class='rounded-b-md',hide_label=true) }}
|
||||||
|
Loading…
Reference in New Issue
Block a user