0x484558
2 weeks ago
Failed to extract signature
3 changed files with
4 additions and
4 deletions
-
src/api/core/two_factor/mod.rs
-
src/api/core/two_factor/webauthn.rs
-
src/api/identity.rs
|
|
|
@ -56,7 +56,7 @@ pub fn is_twofactor_provider_usable(provider_type: i32, provider_data: Option<&s |
|
|
|
x if x == TwoFactorType::YubiKey as i32 => { |
|
|
|
CONFIG._enable_yubico() && CONFIG.yubico_client_id().is_some() && CONFIG.yubico_secret_key().is_some() |
|
|
|
} |
|
|
|
x if x == TwoFactorType::Webauthn as i32 => CONFIG.domain_set(), |
|
|
|
x if x == TwoFactorType::Webauthn as i32 => CONFIG.is_webauthn_2fa_supported(), |
|
|
|
x if x == TwoFactorType::Remember as i32 => !CONFIG.disable_2fa_remember(), |
|
|
|
x if x == TwoFactorType::RecoveryCode as i32 => true, |
|
|
|
_ => false, |
|
|
|
|
|
|
|
@ -108,8 +108,8 @@ impl WebauthnRegistration { |
|
|
|
|
|
|
|
#[post("/two-factor/get-webauthn", data = "<data>")] |
|
|
|
async fn get_webauthn(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { |
|
|
|
if !CONFIG.domain_set() { |
|
|
|
err!("`DOMAIN` environment variable is not set. Webauthn disabled") |
|
|
|
if !CONFIG.is_webauthn_2fa_supported() { |
|
|
|
err!("Configured `DOMAIN` is not compatible with Webauthn") |
|
|
|
} |
|
|
|
|
|
|
|
let data: PasswordOrOtpData = data.into_inner(); |
|
|
|
|
|
|
|
@ -887,7 +887,7 @@ async fn _json_err_twofactor( |
|
|
|
match TwoFactorType::from_i32(*provider) { |
|
|
|
Some(TwoFactorType::Authenticator) => { /* Nothing to do for TOTP */ } |
|
|
|
|
|
|
|
Some(TwoFactorType::Webauthn) if CONFIG.domain_set() => { |
|
|
|
Some(TwoFactorType::Webauthn) if CONFIG.is_webauthn_2fa_supported() => { |
|
|
|
let request = webauthn::generate_webauthn_login(user_id, conn).await?; |
|
|
|
result["TwoFactorProviders2"][provider.to_string()] = request.0; |
|
|
|
} |
|
|
|
|