1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can check if security questions has been defined

This commit is contained in:
2020-07-13 13:15:26 +02:00
parent 515f8d2ffc
commit e76b3180e7
6 changed files with 35 additions and 5 deletions

View File

@ -68,6 +68,10 @@ pub struct User {
pub block_comments_on_his_page: bool,
pub allow_posts_from_friends: bool,
pub account_creation_time: u64,
pub security_question_1: Option<String>,
pub security_answer_1: Option<String>,
pub security_question_2: Option<String>,
pub security_answer_2: Option<String>,
}
impl User {
@ -86,4 +90,12 @@ impl User {
pub fn has_account_image(&self) -> bool {
self.account_image_path.is_some()
}
/// Check out whether security questions have been defined for this user or not
pub fn has_security_questions(&self) -> bool {
self.security_question_1.is_some() &&
self.security_answer_1.is_some() &&
self.security_question_2.is_some() &&
self.security_answer_2.is_some()
}
}