Fix issue with code
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2024-03-26 21:59:43 +01:00
parent 771cbc0888
commit 8d739c6f72

View File

@ -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 });
}