Can check if an account has security questions defined or not.

This commit is contained in:
Pierre 2018-05-21 11:16:28 +02:00
parent bbca6f9ebd
commit 2a397c20aa

View File

@ -84,6 +84,28 @@ class SettingsComponents {
return $this->dbToSecuritySettings($entry); return $this->dbToSecuritySettings($entry);
} }
/**
* Check whether the user has defined security questions or not
*
* @param int $userID Target user ID
* @return bool TRUE if the user has defined security questions / FALSE else
*/
public function has_security_questions(int $userID) : bool {
//Get security settings
$security = $this->get_security($userID);
//Check for errors
if(!$security->isValid())
return FALSE;
return $security->has_security_question_1() &&
$security->has_security_answer_1() &&
$security->has_security_question_2() &&
$security->has_security_answer_2();
}
/** /**
* Save new version of the security settings of a user * Save new version of the security settings of a user
* *