switch tokenlist to uuids

This commit is contained in:
Kai Jan Kriegel 2023-02-24 21:29:22 +01:00
parent d32936e6e6
commit 3e72d915e6

View File

@ -210,20 +210,13 @@ impl card_d_e_s_fire_e_v2::Server for User {
"User API object with nonexisting user \"{}\"", "User API object with nonexisting user \"{}\"",
self.user.get_username() self.user.get_username()
)))); ))));
let tk = user if let Some(tk) = user
.userdata .userdata
.kv .kv
.get("cardtoken") .get("cardtoken") {
.map(|ck| hex::decode(ck).ok())
.flatten()
.unwrap_or_else(|| {
tracing::debug!(user.id = &user.id, "no tokens stored");
Vec::new()
});
if !tk.is_empty() {
let mut b = results.get(); let mut b = results.get();
let mut lb = b.init_token_list(1); let mut lb = b.init_token_list(1);
lb.set(0, &tk[..]); lb.set(0, tk.as_ref());
} }
Promise::ok(()) Promise::ok(())
} }