Can force 2FA authent

This commit is contained in:
2024-03-26 21:07:29 +01:00
parent 4bb515366d
commit dfb277d636
8 changed files with 63 additions and 16 deletions

View File

@@ -90,11 +90,17 @@ impl TwoFactor {
}
}
pub fn login_url(&self, redirect_uri: &LoginRedirect) -> String {
pub fn login_url(&self, redirect_uri: &LoginRedirect, force_2fa: bool) -> String {
match self.kind {
TwoFactorType::TOTP(_) => format!("/2fa_otp?redirect={}", redirect_uri.get_encoded()),
TwoFactorType::TOTP(_) => format!(
"/2fa_otp?redirect={}&force_2fa={force_2fa}",
redirect_uri.get_encoded()
),
TwoFactorType::WEBAUTHN(_) => {
format!("/2fa_webauthn?redirect={}", redirect_uri.get_encoded())
format!(
"/2fa_webauthn?redirect={}&force_2fa={force_2fa}",
redirect_uri.get_encoded()
)
}
}
}