Browse Source

Use more idomatic code

Signed-off-by: BlackDex <black.dex@gmail.com>
pull/5991/head
BlackDex 4 weeks ago
parent
commit
c62db91ab2
No known key found for this signature in database GPG Key ID: 58C80A2AA6C765E1
  1. 12
      src/api/core/two_factor/yubikey.rs

12
src/api/core/two_factor/yubikey.rs

@ -152,16 +152,8 @@ async fn activate_yubikey(data: Json<EnableYubikeyData>, headers: Headers, mut c
verify_yubikey_otp(yubikey.to_owned()).await.map_res("Invalid Yubikey OTP provided")?;
}
let yubikey_ids: Vec<String> = yubikeys
.into_iter()
.filter_map(|x| {
if x.len() >= 12 {
Some((x[..12]).to_owned())
} else {
None
}
})
.collect();
let yubikey_ids: Vec<String> =
yubikeys.into_iter().filter_map(|x| (x.len() >= 12).then(|| x[..12].to_owned())).collect();
let yubikey_metadata = YubikeyMetadata {
keys: yubikey_ids,

Loading…
Cancel
Save