diff --git a/crates/frontend/public/assets/style.css b/crates/frontend/public/assets/style.css
index 2876913..c4dd3f8 100644
--- a/crates/frontend/public/assets/style.css
+++ b/crates/frontend/public/assets/style.css
@@ -1,7 +1,39 @@
body {
font-family: sans-serif;
+ margin: 0;
}
* {
box-sizing: border-box;
}
+
+#app {
+ padding: 12px;
+}
+
+header {
+ background: #EEE;
+ height: 80px;
+ font-weight: bold;
+ display: flex;
+ align-items: center;
+ padding: 12px;
+ font-size: 2em;
+
+ a {
+ text-decoration: none;
+ color: black;
+ }
+
+
+ .logout_form {
+ margin-left: auto;
+ }
+}
+
+.login_window {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
diff --git a/crates/frontend/public/templates/layouts/default.html b/crates/frontend/public/templates/layouts/default.html
index 4467557..5514141 100644
--- a/crates/frontend/public/templates/layouts/default.html
+++ b/crates/frontend/public/templates/layouts/default.html
@@ -10,7 +10,15 @@
-
+ {% block header %}
+
+ {% endblock %}
+
{% block content %}
Placeholder
{% endblock %}
diff --git a/crates/frontend/public/templates/pages/addressbook.html b/crates/frontend/public/templates/pages/addressbook.html
index 9673939..95f3ee3 100644
--- a/crates/frontend/public/templates/pages/addressbook.html
+++ b/crates/frontend/public/templates/pages/addressbook.html
@@ -10,5 +10,4 @@
{{ addressbook|json }}
-
Back
{% endblock %}
diff --git a/crates/frontend/public/templates/pages/calendar.html b/crates/frontend/public/templates/pages/calendar.html
index d044145..c94f57b 100644
--- a/crates/frontend/public/templates/pages/calendar.html
+++ b/crates/frontend/public/templates/pages/calendar.html
@@ -9,6 +9,4 @@
{% if let Some(description) = calendar.description %}
{{ description }}
{% endif%}
{{ calendar|json }}
-
-
Back
{% endblock %}
diff --git a/crates/frontend/public/templates/pages/login.html b/crates/frontend/public/templates/pages/login.html
index c2ef5a1..52c3d40 100644
--- a/crates/frontend/public/templates/pages/login.html
+++ b/crates/frontend/public/templates/pages/login.html
@@ -1,17 +1,22 @@
{% extends "layouts/default.html" %}
{% block content %}
-
Login
-
-{% if let Some(OidcProviderData {name, redirect_url}) = oidc_data %}
-
Login with {{ name }}
-{% endif %}
+
+
Login
+
-{% endblock %}
+ {% if let Some(OidcProviderData {name, redirect_url}) = oidc_data %}
+
Login with {{ name }}
+ {% endif %}
+
+ {% endblock %}
+
diff --git a/crates/frontend/public/templates/pages/user.html b/crates/frontend/public/templates/pages/user.html
index a392f96..480c41b 100644
--- a/crates/frontend/public/templates/pages/user.html
+++ b/crates/frontend/public/templates/pages/user.html
@@ -54,12 +54,22 @@ li.collection-list-item {
}
Welcome {{ user.id }}!
-
Profile
+
+
+
Groups
+
+
+ {% for group in user.memberships %}
+ - {{ group }}
+ {% endfor %}
+
+
App tokens
diff --git a/crates/frontend/src/lib.rs b/crates/frontend/src/lib.rs
index 7309285..9bd834d 100644
--- a/crates/frontend/src/lib.rs
+++ b/crates/frontend/src/lib.rs
@@ -7,7 +7,7 @@ use actix_web::{
dev::ServiceResponse,
http::{Method, StatusCode},
middleware::{ErrorHandlerResponse, ErrorHandlers},
- web::{self, Data, Path},
+ web::{self, Data, Path, Redirect},
};
use askama::Template;
use askama_web::WebTemplate;
@@ -41,7 +41,16 @@ struct UserPage {
pub deleted_addressbooks: Vec,
}
-async fn route_user(
+async fn route_user(user: User, req: HttpRequest) -> Redirect {
+ Redirect::to(
+ req.url_for("frontend_user_named", &[&user.id])
+ .unwrap()
+ .to_string(),
+ )
+ .see_other()
+}
+
+async fn route_user_named(
path: Path,
cal_store: Data,
addr_store: Data,
@@ -79,17 +88,14 @@ async fn route_user(
deleted_calendars,
addressbooks,
deleted_addressbooks,
- user: user,
+ user,
}
.respond_to(&req)
}
async fn route_root(user: Option, req: HttpRequest) -> impl Responder {
let redirect_url = match user {
- Some(user) => req
- .resource_map()
- .url_for(&req, "frontend_user", &[user.id])
- .unwrap(),
+ Some(_) => req.url_for_static("frontend_user").unwrap(),
None => req
.resource_map()
.url_for::<[_; 0], String>(&req, "frontend_login", [])
@@ -150,10 +156,15 @@ pub fn configure_frontend::new("/assets".to_owned()))
.service(web::resource("").route(web::method(Method::GET).to(route_root)))
.service(
- web::resource("/user/{user}")
- .route(web::method(Method::GET).to(route_user::))
+ web::resource("/user")
+ .route(web::method(Method::GET).to(route_user))
.name("frontend_user"),
)
+ .service(
+ web::resource("/user/{user}")
+ .route(web::method(Method::GET).to(route_user_named::))
+ .name("frontend_user_named"),
+ )
.service(
web::resource("/user/{user}/calendar/{calendar}")
.route(web::method(Method::GET).to(route_calendar::)),
diff --git a/crates/frontend/src/oidc/mod.rs b/crates/frontend/src/oidc/mod.rs
index a2a73c2..a1014f8 100644
--- a/crates/frontend/src/oidc/mod.rs
+++ b/crates/frontend/src/oidc/mod.rs
@@ -230,7 +230,7 @@ pub async fn route_get_oidc_callback(
session.insert("user", user.id.clone())?;
Ok(
- Redirect::to(req.url_for("frontend_user", &[user.id])?.to_string())
+ Redirect::to(req.url_for_static("frontend_user")?.to_string())
.temporary()
.respond_to(&req)
.map_into_boxed_body(),