fix to redirect

This commit is contained in:
EvilMuffinHa 2021-09-12 17:49:52 -04:00
parent 60f40bdd55
commit 6013abf15c
4 changed files with 5 additions and 11 deletions

View File

@ -5,7 +5,7 @@ use oauth2::{
};
use reqwest::blocking::Client;
use rocket::{
http::{Cookie, Cookies, SameSite, Status},
http::{Cookie, Cookies, Status},
request,
request::FromRequest,
response::Redirect,
@ -170,7 +170,7 @@ pub fn callback(
};
if auths.into_iter().any(|x| x == email.as_str().unwrap_or("")) {
let mut cook = Cookie::new("token", secret.to_string());
cook.set_same_site(SameSite::Strict);
// cook.set_same_site(SameSite::Strict);
cook.set_http_only(true);
cook.set_secure(true);
cookies.add(cook);

View File

@ -125,14 +125,6 @@ pub mod defs {
type Error = ();
fn from_form_value(value: &'v RawStr) -> Result<Image, ()> {
/*
println!("{:?}", value);
let file = NamedFile::open(value.to_string());
println!("{:?}", file);
Ok(Image(String::from("pepega")))
*/
let value_uri = match value.url_decode() {
Ok(n) => n,
Err(_) => return Err(()),

View File

@ -73,7 +73,7 @@ fn rocket(port: u16, address: String, env: Environment, pg: PgConnection, sa: Se
.manage(sa)
.mount(
"/",
routes![home, home_not_logged_in, login, auth::callback, auth::oauth, static_files],
routes![home, home_not_logged_in, login, auth::callback, auth::oauth, static_files, auth::logout],
)
.mount("/api", routes![
data::student::api,

View File

@ -6,6 +6,8 @@
<head>
</head>
<body>
<a href="/logout">Logout</a>
<br>
<a href="/ui/events">Events</a>
<a href="/ui/new">New</a>
<a href="/ui/announcements">Announcements</a>