deprecate old get/set cookie functions

This commit is contained in:
neil 2021-04-12 23:59:22 +02:00
parent 1251b431a6
commit 5a521b0497
1 changed files with 0 additions and 19 deletions

View File

@ -36,23 +36,6 @@ pub fn is_logged_in(req: &HttpRequest) -> Option<&str> {
}
}
pub fn has_admintoken(req: &HttpRequest) -> Option<String> {
get_cookie(req, "sncf_admin_token")
}
pub fn has_csrftoken(req: &HttpRequest) -> Option<String> {
get_cookie(req, "sncf_csrf_cookie")
}
fn get_cookie(req: &HttpRequest, cookie_name: &str) -> Option<String> {
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<token>[^"]*)"\}"#)