mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-04 15:53:21 +03:00
handling case where keyfile lock contains value of none
This commit is contained in:
parent
283c900a76
commit
584d5e958c
@ -106,7 +106,13 @@ pub async fn register(
|
||||
}
|
||||
|
||||
async fn handle_has_keyfile(keyfile: Arc<Mutex<Option<Vec<u8>>>>) -> Result<impl Reply, Rejection> {
|
||||
|
||||
let keyfile_lock = keyfile.lock().unwrap();
|
||||
|
||||
if keyfile_lock.is_none() {
|
||||
return Ok(warp::reply::json(&"".to_string()))
|
||||
}
|
||||
|
||||
let encoded_keyfile = keyfile_lock.as_ref().unwrap();
|
||||
let username: String = match encoded_keyfile.is_empty() {
|
||||
true => "".to_string(),
|
||||
@ -116,7 +122,9 @@ async fn handle_has_keyfile(keyfile: Arc<Mutex<Option<Vec<u8>>>>) -> Result<impl
|
||||
}
|
||||
};
|
||||
|
||||
Ok(warp::reply::json(&username))
|
||||
Ok(warp::reply::json(
|
||||
&username
|
||||
))
|
||||
}
|
||||
|
||||
async fn handle_keyfile_vet(
|
||||
@ -180,6 +188,7 @@ async fn handle_boot(
|
||||
jwt_secret_bytes: jwt_secret.to_vec(),
|
||||
file_key: keygen::generate_file_key(),
|
||||
}
|
||||
|
||||
} else {
|
||||
match keygen::decode_keyfile(encoded_keyfile.clone(), &info.password) {
|
||||
Ok(k) => k,
|
||||
|
Loading…
Reference in New Issue
Block a user