1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-07-03 14:43:28 +00:00

Add password to security keys

This commit is contained in:
2021-07-11 17:54:15 +02:00
parent 28b24f39b0
commit cb44497fee
7 changed files with 24 additions and 3 deletions

View File

@ -10,6 +10,7 @@ use crate::data::admin::{Admin, AdminKey};
struct AuthKey {
name: String,
id: u64,
password: bool,
}
#[derive(Serialize)]
@ -22,7 +23,7 @@ impl AdminAuthOptions {
pub fn new(admin: &Admin, keys: &Vec<AdminKey>) -> Self {
Self {
reset_token: admin.reset_token.is_some(),
keys: keys.iter().map(|k| AuthKey { id: k.id, name: k.name.to_string() }).collect(),
keys: keys.iter().map(|k| AuthKey { id: k.id, name: k.name.to_string(), password: k.password.is_some() }).collect(),
}
}
}

View File

@ -10,6 +10,7 @@ pub struct AdminKeyAPI {
id: u64,
name: String,
time_add: u64,
has_password: bool,
}
impl AdminKeyAPI {
@ -18,6 +19,7 @@ impl AdminKeyAPI {
id: key.id,
name: key.name.to_string(),
time_add: key.time_add,
has_password: key.password.is_some(),
}
}
}