Refactor decryption logic to handle empty fields consistently across services
This commit is contained in:
@@ -21,7 +21,7 @@ pub fn return_user_infos(conn: &Connection, user_id: &str, lang: Lang) -> AppRes
|
||||
|
||||
let username: String = decrypt_data_with_user_key(&user_infos_data.username, &user_encryption_key)?;
|
||||
let email: String = decrypt_data_with_user_key(&user_infos_data.email, &user_encryption_key)?;
|
||||
let author_name: String = if let Some(ref author_name_val) = user_infos_data.author_name { decrypt_data_with_user_key(author_name_val, &user_encryption_key)? } else { String::new() };
|
||||
let author_name: String = if let Some(ref author_name_val) = user_infos_data.author_name { if author_name_val.is_empty() { String::new() } else { decrypt_data_with_user_key(author_name_val, &user_encryption_key)? } } else { String::new() };
|
||||
|
||||
Ok(UserInfoResponse {
|
||||
id: user_id.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user