1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 09:12:57 +01:00

Fix purge from other paths than root (#129)

Co-authored-by: Rob Ede <robjtede@icloud.com>
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
This commit is contained in:
Quentin Kniep 2020-12-03 18:52:48 +00:00 committed by GitHub
parent f970d90894
commit 936a116264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@
## Unreleased - 2020-xx-xx
* `Session::set_session` takes a `IntoIterator` instead of `Iterator`
* Fix calls to `session.purge()` from paths other than the one specified in the cookie
## 0.4.0 - 2020-09-11

View File

@ -136,6 +136,7 @@ impl CookieSessionInner {
/// invalidates session cookie
fn remove_cookie<B>(&self, res: &mut ServiceResponse<B>) -> Result<(), Error> {
let mut cookie = Cookie::named(self.name.clone());
cookie.set_path(self.path.clone());
cookie.set_value("");
cookie.set_max_age(Duration::zero());
cookie.set_expires(OffsetDateTime::now_utc() - Duration::days(365));