mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-02-22 16:51:17 +00:00
21 lines
556 B
Rust
21 lines
556 B
Rust
|
//! # Get security questions results
|
||
|
//!
|
||
|
//! @author Pierre Hubert
|
||
|
use serde::Serialize;
|
||
|
|
||
|
use crate::data::user::User;
|
||
|
|
||
|
#[derive(Serialize)]
|
||
|
pub struct ResGetSecurityQuestions {
|
||
|
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()));
|
||
|
|
||
|
ResGetSecurityQuestions { questions }
|
||
|
}
|
||
|
}
|