Skip to content

Commit

Permalink
invalidate all user sessions after a password reset
Browse files Browse the repository at this point in the history
Signed-off-by: sebadob <sebastiandobe@mailbox.org>
  • Loading branch information
sebadob committed Nov 24, 2023
1 parent 20d69ca commit 570dea6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rauthy-service/src/password_reset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rauthy_models::app_state::AppState;
use rauthy_models::entity::colors::ColorEntity;
use rauthy_models::entity::magic_links::{MagicLink, MagicLinkUsage};
use rauthy_models::entity::password::PasswordPolicy;
use rauthy_models::entity::sessions::Session;
use rauthy_models::entity::users::User;
use rauthy_models::entity::webauthn;
use rauthy_models::entity::webauthn::WebauthnServiceReq;
Expand Down Expand Up @@ -218,6 +219,9 @@ pub async fn handle_put_user_password_reset<'a>(
.await
.unwrap();

// delete all existing user sessions to have a clean flow
Session::invalidate_for_user(data, &user.id).await?;

// delete the cookie
let cookie = cookie::Cookie::build(PWD_RESET_COOKIE, "")
.secure(true)
Expand Down

0 comments on commit 570dea6

Please sign in to comment.