From 5a521b0497acb1a96f5d96c56d6f81d0d3c598b2 Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 12 Apr 2021 23:59:22 +0200 Subject: [PATCH] deprecate old get/set cookie functions --- src/account.rs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/account.rs b/src/account.rs index 12077f0..c89f393 100644 --- a/src/account.rs +++ b/src/account.rs @@ -36,23 +36,6 @@ pub fn is_logged_in(req: &HttpRequest) -> Option<&str> { } } -pub fn has_admintoken(req: &HttpRequest) -> Option { - get_cookie(req, "sncf_admin_token") -} - -pub fn has_csrftoken(req: &HttpRequest) -> Option { - get_cookie(req, "sncf_csrf_cookie") -} - -fn get_cookie(req: &HttpRequest, cookie_name: &str) -> Option { - let c = req.headers().get("Cookie")?.to_str().ok()?; - if c.contains(cookie_name) { - Some(c.to_string()) - } else { - None - } -} - // attempts to create the account from Nextcloud's API // returns the newly created username. // if it fails (bad return code), returns None. @@ -207,8 +190,6 @@ pub async fn login( str_cookiepair.push_str(&format!("{}={}; ", cookie_k, cookie_v)); } - println!("SET-COOKIE: {}", str_cookiepair); - // load requesttoken regex lazy_static! { static ref RE: Regex = Regex::new(r#"\{"token":"(?P[^"]*)"\}"#)