1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-25 13:08:50 +00:00

Improve code readability

This commit is contained in:
Pierre HUBERT 2022-03-17 18:34:42 +01:00
parent bd272b2d36
commit 287937ac63

View File

@ -7,14 +7,15 @@ use crate::data::user::User;
#[derive(Serialize)]
pub struct ResGetSecurityQuestions {
questions: Vec<String>
questions: Vec<String>,
}
impl ResGetSecurityQuestions {
pub fn new(user: &User) -> ResGetSecurityQuestions {
let mut questions = Vec::new();
questions.push(user.security_question_1.clone().unwrap_or(String::new()));
questions.push(user.security_question_2.clone().unwrap_or(String::new()));
let questions = vec![
user.security_question_1.clone().unwrap_or_default(),
user.security_question_2.clone().unwrap_or_default(),
];
ResGetSecurityQuestions { questions }
}