mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-07-04 11:34:59 +00:00
Use more idomatic code
Signed-off-by: BlackDex <black.dex@gmail.com>
This commit is contained in:
parent
33d7486516
commit
c62db91ab2
1 changed files with 2 additions and 10 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue