diff --git a/assets/templates/rc_society/dashboard.html.hbs b/assets/templates/rc_society/dashboard.html.hbs index 852e9f4..b1155ab 100644 --- a/assets/templates/rc_society/dashboard.html.hbs +++ b/assets/templates/rc_society/dashboard.html.hbs @@ -29,7 +29,8 @@
Welcome {{form.display_name}}! | - Home + Home | + Sign Out

{{form.display_name}} Dashboard

{{#if error}} diff --git a/assets/templates/rc_society/garage_import.html.hbs b/assets/templates/rc_society/garage_import.html.hbs index 3a4eb04..72d3505 100644 --- a/assets/templates/rc_society/garage_import.html.hbs +++ b/assets/templates/rc_society/garage_import.html.hbs @@ -29,7 +29,9 @@
Welcome {{form.display_name}}! | - Home + Home | + Dashboard | + Sign Out

{{form.display_name}} Garage {{#if form.garage}}#{{form.garage.slot}}{{/if}} Import

{{#if error}} diff --git a/assets/templates/rc_society/garage_info.html.hbs b/assets/templates/rc_society/garage_info.html.hbs index 499e0a6..16ad6c3 100644 --- a/assets/templates/rc_society/garage_info.html.hbs +++ b/assets/templates/rc_society/garage_info.html.hbs @@ -29,7 +29,9 @@
Welcome {{form.display_name}}! | - Home + Home | + Dashboard | + Sign Out

{{form.display_name}} Garage #{{form.garage.slot}}

{{#if error}} diff --git a/assets/templates/rc_society/garage_list.html.hbs b/assets/templates/rc_society/garage_list.html.hbs index 72a6cba..c91f8b3 100644 --- a/assets/templates/rc_society/garage_list.html.hbs +++ b/assets/templates/rc_society/garage_list.html.hbs @@ -29,7 +29,9 @@
Welcome {{form.display_name}}! | - Home + Home | + Dashboard | + Sign Out

{{form.display_name}} Garages

{{#if error}} diff --git a/assets/templates/rc_society/index.html.hbs b/assets/templates/rc_society/index.html.hbs index dbb4513..7af9e25 100644 --- a/assets/templates/rc_society/index.html.hbs +++ b/assets/templates/rc_society/index.html.hbs @@ -29,7 +29,8 @@
{{#if form.is_logged_in}} Welcome {{form.display_name}}! | - Dashboard + Dashboard | + Sign Out {{else}} Login {{/if}} diff --git a/assets/templates/rc_society/stylesheet.html.hbs b/assets/templates/rc_society/stylesheet.html.hbs index 30f2d28..5033e16 100644 --- a/assets/templates/rc_society/stylesheet.html.hbs +++ b/assets/templates/rc_society/stylesheet.html.hbs @@ -18,7 +18,7 @@ body { } .form-header-right { position: relative; - width: 25%; + width: 50%; text-align: right; margin: 0 0 0 auto; box-sizing: border-box; diff --git a/assets/templates/rc_society/user_federation.html.hbs b/assets/templates/rc_society/user_federation.html.hbs index c44067b..f5f0e37 100644 --- a/assets/templates/rc_society/user_federation.html.hbs +++ b/assets/templates/rc_society/user_federation.html.hbs @@ -29,7 +29,9 @@
Welcome {{form.display_name}}! | - Home + Home | + Dashboard | + Sign Out

{{form.display_name}} Federation Settings

{{#if error}} diff --git a/rc_society/src/main.rs b/rc_society/src/main.rs index 2672b45..a23ee44 100644 --- a/rc_society/src/main.rs +++ b/rc_society/src/main.rs @@ -86,6 +86,7 @@ async fn main() -> std::io::Result<()> { .service(version_info) .service(web::login::form_submit) .service(web::login::form_load) + .service(web::logout::get) .service(web::favicon::favicon_standard) .service(web::dashboard::get) .service(web::dashboard::post) // for login redirect diff --git a/rc_society/src/web/logout.rs b/rc_society/src/web/logout.rs new file mode 100644 index 0000000..fced439 --- /dev/null +++ b/rc_society/src/web/logout.rs @@ -0,0 +1,12 @@ +use actix_web::{get, web::Redirect, Responder, HttpRequest}; +use actix_identity::Identity; + +#[get("/logout")] +pub async fn get(user_opt: Option, req: HttpRequest) -> Result { + if let Some(user) = user_opt { + user.logout(); + } + Ok(Redirect::to("/") + .respond_to(&req) + .map_into_boxed_body()) +} diff --git a/rc_society/src/web/mod.rs b/rc_society/src/web/mod.rs index ff1eaee..b14f519 100644 --- a/rc_society/src/web/mod.rs +++ b/rc_society/src/web/mod.rs @@ -4,6 +4,7 @@ pub mod favicon; pub mod index; pub mod garage; pub mod user_federation; +pub mod logout; use serde::Serialize; use actix_web::{web::{Html, Redirect}, Responder};