Change User validation to use encrypted cookies

master
fernando 2024-02-14 12:01:08 -05:00
parent fc390bc5ef
commit ee7297ab1f
1 changed files with 2 additions and 2 deletions

View File

@ -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, ())),
}; };