mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Can update user password
This commit is contained in:
		@@ -224,6 +224,25 @@ class AccountComponent {
 | 
			
		||||
		return CS::get()->db->count(self::USER_TABLE, $sql_conds, $values) > 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Update user password
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param int $userID Target user ID
 | 
			
		||||
	 * @param string $password The new password to set to the user
 | 
			
		||||
	 * @return bool TRUE in case of success / FALSE else
 | 
			
		||||
	 */
 | 
			
		||||
	public function set_new_user_password(int $userID, string $password) : bool {
 | 
			
		||||
 | 
			
		||||
		//Crypt the password
 | 
			
		||||
		$password = $this->cryptPassword($password);
 | 
			
		||||
 | 
			
		||||
		//Prepare database update
 | 
			
		||||
		$modif = array("password" => $password);
 | 
			
		||||
 | 
			
		||||
		//Perform the request
 | 
			
		||||
		return CS::get()->db->updateDB(self::USER_TABLE, "ID = ?", $modif, array($userID));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Crypt user password
 | 
			
		||||
	 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user