Skip to content
Snippets Groups Projects
Commit 1a3b60c6 authored by Mika Specht's avatar Mika Specht
Browse files

Fix unauthorized on index-site for invalid(outdated) tokens

parent d324ed1d
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,10 @@ impl<'a> FromRequest<'a> for Session { ...@@ -59,7 +59,10 @@ impl<'a> FromRequest<'a> for Session {
unsafe { unsafe {
if !SESSIONS.contains_key(&token) { if !SESSIONS.contains_key(&token) {
println!("Invalid Token: {:?},", token); println!("Invalid Token: {:?},", token);
Outcome::Error((Status::Unauthorized, "Invalid Token")) //remove the invalid token
req.cookies().remove_private("session-token");
// We forward so there can be not-logged in paths
return Outcome::Forward(Status::Unauthorized);
} else { } else {
Outcome::Success(Session { token }) Outcome::Success(Session { token })
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment