mirror of
https://github.com/Blair-SGA-Dev-Team/blazerapp.git
synced 2024-11-22 04:51:15 -05:00
fix to redirect
This commit is contained in:
parent
60f40bdd55
commit
6013abf15c
|
@ -5,7 +5,7 @@ use oauth2::{
|
||||||
};
|
};
|
||||||
use reqwest::blocking::Client;
|
use reqwest::blocking::Client;
|
||||||
use rocket::{
|
use rocket::{
|
||||||
http::{Cookie, Cookies, SameSite, Status},
|
http::{Cookie, Cookies, Status},
|
||||||
request,
|
request,
|
||||||
request::FromRequest,
|
request::FromRequest,
|
||||||
response::Redirect,
|
response::Redirect,
|
||||||
|
@ -170,7 +170,7 @@ pub fn callback(
|
||||||
};
|
};
|
||||||
if auths.into_iter().any(|x| x == email.as_str().unwrap_or("")) {
|
if auths.into_iter().any(|x| x == email.as_str().unwrap_or("")) {
|
||||||
let mut cook = Cookie::new("token", secret.to_string());
|
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_http_only(true);
|
||||||
cook.set_secure(true);
|
cook.set_secure(true);
|
||||||
cookies.add(cook);
|
cookies.add(cook);
|
||||||
|
|
|
@ -125,14 +125,6 @@ pub mod defs {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn from_form_value(value: &'v RawStr) -> Result<Image, ()> {
|
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() {
|
let value_uri = match value.url_decode() {
|
||||||
Ok(n) => n,
|
Ok(n) => n,
|
||||||
Err(_) => return Err(()),
|
Err(_) => return Err(()),
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn rocket(port: u16, address: String, env: Environment, pg: PgConnection, sa: Se
|
||||||
.manage(sa)
|
.manage(sa)
|
||||||
.mount(
|
.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![
|
.mount("/api", routes![
|
||||||
data::student::api,
|
data::student::api,
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
<head>
|
<head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<a href="/logout">Logout</a>
|
||||||
|
<br>
|
||||||
<a href="/ui/events">Events</a>
|
<a href="/ui/events">Events</a>
|
||||||
<a href="/ui/new">New</a>
|
<a href="/ui/new">New</a>
|
||||||
<a href="/ui/announcements">Announcements</a>
|
<a href="/ui/announcements">Announcements</a>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user