mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Can check if an account has security questions defined or not.
This commit is contained in:
		@@ -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
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user