mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-26 13:38:58 +00:00
Can check if an account has security questions defined or not.
This commit is contained in:
parent
bbca6f9ebd
commit
2a397c20aa
@ -84,6 +84,28 @@ class SettingsComponents {
|
||||
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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user