send loggedin_user in /admin/user

This commit is contained in:
philipp 2023-04-06 18:57:10 +02:00
parent 194577f9bd
commit f034a780a2
3 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,6 @@
# Notes / Bugfixes # Notes / Bugfixes
- [ ] User loggedin status not present on user admin interface (header/footer not rendering) [ph] - [ ] User loggedin status not present on user admin interface (header/footer not rendering) [ph]
- [ ] is_cox: cox can become cox and than rower at the same event, (rower and than cox -> exception working) [ph]
- [ ] Mobile Breakpoint: Add user broken user admin interface [mb] - [ ] Mobile Breakpoint: Add user broken user admin interface [mb]
# Frontend Process # Frontend Process

View File

@ -204,8 +204,9 @@ impl<'r> FromRequest<'r> for CoxUser {
} }
} }
#[derive(Debug, Serialize, Deserialize)]
pub struct AdminUser { pub struct AdminUser {
user: User, pub(crate) user: User,
} }
impl TryFrom<User> for AdminUser { impl TryFrom<User> for AdminUser {

View File

@ -9,9 +9,12 @@ use rocket_dyn_templates::{context, Template};
use sqlx::SqlitePool; use sqlx::SqlitePool;
#[get("/user")] #[get("/user")]
async fn index(db: &State<SqlitePool>, _admin: AdminUser) -> Template { async fn index(db: &State<SqlitePool>, admin: AdminUser) -> Template {
let users = User::all(db).await; let users = User::all(db).await;
Template::render("admin/user/index", context!(users)) Template::render(
"admin/user/index",
context!(users, loggedin_user: admin.user),
)
} }
#[get("/user/<user>/reset-pw")] #[get("/user/<user>/reset-pw")]