diff --git a/src/main.rs b/src/main.rs index 7ef2bac..7721e34 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,10 @@ use num::BigUint; use openssl::rsa::Rsa; use ldap3::{ LdapConn, Scope, SearchEntry }; +use rocket::http::{ + Cookie, + Cookies, +}; use rocket::request::{ FlashMessage, Form, @@ -149,7 +153,7 @@ fn login_form(flash: Option>) -> Template { } #[post("/login", data = "")] -fn login(form_data: Form, conn: AuthDb) -> Result> { +fn login(form_data: Form, conn: AuthDb, mut cookies: Cookies) -> Result> { let auth = BasicAuthentication { username: form_data.username.to_owned(), password: form_data.password.to_owned(), @@ -165,6 +169,7 @@ fn login(form_data: Form, conn: AuthDb) -> Result FromRequest<'a, 'r> for User { type Error = (); fn from_request(request: &'a Request<'r>) -> Outcome { - let mut user_id = match request.cookies().get_private("user_id") { + let user_id = match request.cookies().get_private("user_id") { Some(cookie) => cookie.value().to_string(), None => return Outcome::Forward(()), };