Browse Source
Use more idomatic code - take 2
Signed-off-by: BlackDex <black.dex@gmail.com>
pull/5991/head
BlackDex
4 weeks ago
No known key found for this signature in database
GPG Key ID: 58C80A2AA6C765E1
1 changed files with
1 additions and
2 deletions
-
src/api/core/two_factor/yubikey.rs
|
|
@ -152,8 +152,7 @@ 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| (x.len() >= 12).then(|| x[..12].to_owned())).collect(); |
|
|
|
let yubikey_ids: Vec<String> = yubikeys.into_iter().filter_map(|x| x.get(..12).map(str::to_owned)).collect(); |
|
|
|
|
|
|
|
let yubikey_metadata = YubikeyMetadata { |
|
|
|
keys: yubikey_ids, |
|
|
|