From 8d739c6f72baa83e22ca09d2ca2ce1b5863d1abe Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 26 Mar 2024 21:59:43 +0100 Subject: [PATCH] Fix issue with code --- src/data/force_2fa_auth.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/data/force_2fa_auth.rs b/src/data/force_2fa_auth.rs index 0d27770..f5a0531 100644 --- a/src/data/force_2fa_auth.rs +++ b/src/data/force_2fa_auth.rs @@ -25,8 +25,10 @@ impl FromRequest for Force2FAAuth { Box::pin(async move { // It is impossible to force authentication for an unauthenticated user - let identity: Option<&Identity> = req.conn_data(); - if !SessionIdentity(identity).is_authenticated() { + let identity = Identity::from_request(&req, &mut Payload::None) + .into_inner() + .ok(); + if !SessionIdentity(identity.as_ref()).is_authenticated() { return Ok(Self { force: false }); }