Require to accept cookies policy for log in

O01eg
Oct 22, 2022, 8:44 AM
WEVOADLSI5FOOXBM5YPAWEIYN2CXROAQ44CLGYOVTJ2OCLSOONYQC

Dependencies

  • [2] FUCFD4UV Add log in and log out support
  • [3] MFJBQU5F Fix check if web password wasn't set

Change contents

  • replacement in src/pages/log_in.rs at line 22
    [2.3034][2.3034:3106]()
    pub async fn get_log_in(data: web::Data<WebData<'_>>) -> HttpResponse {
    [2.3034]
    [2.3106]
    pub async fn get_log_in(request: HttpRequest, data: web::Data<WebData<'_>>) -> HttpResponse {
  • edit in src/pages/log_in.rs at line 34
    [2.3342]
    [2.3342]
    let jar = request_to_jar(request);
    if !jar
    .private(&data.cookies_key)
    .get("i_accept_cookie")
    .map_or(false, |x| x.value() == "yes")
    {
    return HttpResponse::Found()
    .append_header((header::LOCATION, "cookies-policy.html"))
    .finish();
    }
  • edit in src/pages/log_in.rs at line 106
    [2.5337]
    [2.5337]
    if !jar
    .private(&data.cookies_key)
    .get("i_accept_cookie")
    .map_or(false, |x| x.value() == "yes")
    {
    return HttpResponse::Found()
    .append_header((header::LOCATION, "cookies-policy.html"))
    .finish();
    }