forked from Ruderverein-Donau-Linz/rowt
show last access time
This commit is contained in:
parent
8c38a2faf6
commit
968ab00cc0
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2193,6 +2193,7 @@ dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"crc",
|
||||
"crossbeam-queue",
|
||||
"dotenvy",
|
||||
@ -2223,6 +2224,7 @@ dependencies = [
|
||||
"sqlx-rt",
|
||||
"stringprep",
|
||||
"thiserror",
|
||||
"time 0.3.21",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"webpki-roots",
|
||||
|
@ -10,7 +10,7 @@ rocket = { version = "0.5.0-rc.3", features = ["secrets"]}
|
||||
rocket_dyn_templates = {version = "0.1.0-rc.3", features = [ "tera" ] }
|
||||
log = "0.4"
|
||||
env_logger = "0.10"
|
||||
sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls", "macros"] }
|
||||
sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls", "macros", "chrono", "time"] }
|
||||
argon2 = "0.5"
|
||||
serde = { version = "1.0", features = [ "derive" ]}
|
||||
serde_json = "1.0"
|
||||
|
@ -5,7 +5,7 @@ use rocket::{
|
||||
async_trait,
|
||||
http::Status,
|
||||
request::{self, FromRequest, Outcome},
|
||||
Request, State,
|
||||
Request,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{FromRow, SqlitePool};
|
||||
@ -20,6 +20,7 @@ pub struct User {
|
||||
pub is_guest: bool,
|
||||
#[serde(default = "bool::default")]
|
||||
deleted: bool,
|
||||
pub last_access: Option<chrono::NaiveDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -37,7 +38,7 @@ impl User {
|
||||
sqlx::query_as!(
|
||||
User,
|
||||
"
|
||||
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted
|
||||
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted, last_access
|
||||
FROM user
|
||||
WHERE id like ?
|
||||
",
|
||||
@ -52,7 +53,7 @@ WHERE id like ?
|
||||
sqlx::query_as!(
|
||||
User,
|
||||
"
|
||||
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted
|
||||
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted, last_access
|
||||
FROM user
|
||||
WHERE name like ?
|
||||
",
|
||||
@ -67,7 +68,7 @@ WHERE name like ?
|
||||
sqlx::query_as!(
|
||||
User,
|
||||
"
|
||||
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted
|
||||
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted, last_access
|
||||
FROM user
|
||||
WHERE deleted = 0
|
||||
ORDER BY name
|
||||
|
@ -41,7 +41,11 @@
|
||||
<form action="/admin/user" data-filterable="true" data-filter="{{ user.name }}" method="post" class="bg-white p-3 rounded-md flex items-end md:items-center justify-between">
|
||||
<div class="w-full">
|
||||
<input type="hidden" name="id" value="{{ user.id }}" />
|
||||
<div class="font-bold mb-1">{{ user.name }}</div>
|
||||
<div class="font-bold mb-1">{{ user.name }}
|
||||
{% if user.last_access %}
|
||||
(last access: {{ user.last_access | date }})
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid md:grid-cols-3">
|
||||
{{ macros::checkbox(label='Gast', name='is_guest', id=loop.index , checked=user.is_guest) }}
|
||||
{{ macros::checkbox(label='Steuerberechtigter', name='is_cox', id=loop.index , checked=user.is_cox) }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user