1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add logout endpoint for rc_society; close #140

This commit is contained in:
NG (Graham)
2026-07-09 17:25:02 -04:00
parent 8c3b74cba3
commit 60bad02c87
10 changed files with 31 additions and 7 deletions

View File

@@ -29,7 +29,8 @@
<div class="form-stripe">
<div class="form-header-right">
Welcome {{form.display_name}}! |
<a href="/">Home</a>
<a href="/">Home</a> |
<a href="/logout">Sign Out</a>
</div>
<h1 class="form-banner">{{form.display_name}} Dashboard</h1>
{{#if error}}

View File

@@ -29,7 +29,9 @@
<div class="form-stripe">
<div class="form-header-right">
Welcome {{form.display_name}}! |
<a href="/">Home</a>
<a href="/">Home</a> |
<a href="/dashboard">Dashboard</a> |
<a href="/logout">Sign Out</a>
</div>
<h1 class="form-banner">{{form.display_name}} Garage {{#if form.garage}}#{{form.garage.slot}}{{/if}} Import</h1>
{{#if error}}

View File

@@ -29,7 +29,9 @@
<div class="form-stripe">
<div class="form-header-right">
Welcome {{form.display_name}}! |
<a href="/">Home</a>
<a href="/">Home</a> |
<a href="/dashboard">Dashboard</a> |
<a href="/logout">Sign Out</a>
</div>
<h1 class="form-banner">{{form.display_name}} Garage #{{form.garage.slot}}</h1>
{{#if error}}

View File

@@ -29,7 +29,9 @@
<div class="form-stripe">
<div class="form-header-right">
Welcome {{form.display_name}}! |
<a href="/">Home</a>
<a href="/">Home</a> |
<a href="/dashboard">Dashboard</a> |
<a href="/logout">Sign Out</a>
</div>
<h1 class="form-banner">{{form.display_name}} Garages</h1>
{{#if error}}

View File

@@ -29,7 +29,8 @@
<div class="form-header-right">
{{#if form.is_logged_in}}
Welcome {{form.display_name}}! |
<a href="/dashboard">Dashboard</a>
<a href="/dashboard">Dashboard</a> |
<a href="/logout">Sign Out</a>
{{else}}
<a href="/login">Login</a>
{{/if}}

View File

@@ -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;

View File

@@ -29,7 +29,9 @@
<div class="form-stripe">
<div class="form-header-right">
Welcome {{form.display_name}}! |
<a href="/">Home</a>
<a href="/">Home</a> |
<a href="/dashboard">Dashboard</a> |
<a href="/logout">Sign Out</a>
</div>
<h1 class="form-banner">{{form.display_name}} Federation Settings</h1>
{{#if error}}

View File

@@ -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

View File

@@ -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<Identity>, req: HttpRequest) -> Result<impl Responder, actix_web::error::Error> {
if let Some(user) = user_opt {
user.logout();
}
Ok(Redirect::to("/")
.respond_to(&req)
.map_into_boxed_body())
}

View File

@@ -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};