Change User validation to use encrypted cookies
This commit is contained in:
parent
fc390bc5ef
commit
ee7297ab1f
@ -18,10 +18,10 @@ impl<'r> FromRequest<'r> for User {
|
|||||||
|
|
||||||
async fn from_request(req: &'r Request<'_>) -> Outcome<Self, ()> {
|
async fn from_request(req: &'r Request<'_>) -> Outcome<Self, ()> {
|
||||||
// get the session id from the cookie
|
// get the session id from the cookie
|
||||||
let session_opt = req.cookies().get("rocket_session_id");
|
let session_opt = req.cookies().get_private("rocket_session_id");
|
||||||
|
|
||||||
let session_id_str = match session_opt {
|
let session_id_str = match session_opt {
|
||||||
Some(s) => s.value(),
|
Some(s) => s.value().to_owned(),
|
||||||
None => return Outcome::Error((Status::Unauthorized, ())),
|
None => return Outcome::Error((Status::Unauthorized, ())),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user