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",
|
"bitflags 1.3.2",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"chrono",
|
||||||
"crc",
|
"crc",
|
||||||
"crossbeam-queue",
|
"crossbeam-queue",
|
||||||
"dotenvy",
|
"dotenvy",
|
||||||
@ -2223,6 +2224,7 @@ dependencies = [
|
|||||||
"sqlx-rt",
|
"sqlx-rt",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"time 0.3.21",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"url",
|
"url",
|
||||||
"webpki-roots",
|
"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" ] }
|
rocket_dyn_templates = {version = "0.1.0-rc.3", features = [ "tera" ] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
env_logger = "0.10"
|
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"
|
argon2 = "0.5"
|
||||||
serde = { version = "1.0", features = [ "derive" ]}
|
serde = { version = "1.0", features = [ "derive" ]}
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -5,7 +5,7 @@ use rocket::{
|
|||||||
async_trait,
|
async_trait,
|
||||||
http::Status,
|
http::Status,
|
||||||
request::{self, FromRequest, Outcome},
|
request::{self, FromRequest, Outcome},
|
||||||
Request, State,
|
Request,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, SqlitePool};
|
use sqlx::{FromRow, SqlitePool};
|
||||||
@ -20,6 +20,7 @@ pub struct User {
|
|||||||
pub is_guest: bool,
|
pub is_guest: bool,
|
||||||
#[serde(default = "bool::default")]
|
#[serde(default = "bool::default")]
|
||||||
deleted: bool,
|
deleted: bool,
|
||||||
|
pub last_access: Option<chrono::NaiveDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -37,7 +38,7 @@ impl User {
|
|||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
User,
|
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
|
FROM user
|
||||||
WHERE id like ?
|
WHERE id like ?
|
||||||
",
|
",
|
||||||
@ -52,7 +53,7 @@ WHERE id like ?
|
|||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
User,
|
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
|
FROM user
|
||||||
WHERE name like ?
|
WHERE name like ?
|
||||||
",
|
",
|
||||||
@ -67,7 +68,7 @@ WHERE name like ?
|
|||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
User,
|
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
|
FROM user
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
ORDER BY name
|
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">
|
<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">
|
<div class="w-full">
|
||||||
<input type="hidden" name="id" value="{{ user.id }}" />
|
<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">
|
<div class="grid md:grid-cols-3">
|
||||||
{{ macros::checkbox(label='Gast', name='is_guest', id=loop.index , checked=user.is_guest) }}
|
{{ 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) }}
|
{{ macros::checkbox(label='Steuerberechtigter', name='is_cox', id=loop.index , checked=user.is_cox) }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user