diff --git a/classes/components/account.php b/classes/components/account.php index 6e8c567..7117d40 100644 --- a/classes/components/account.php +++ b/classes/components/account.php @@ -157,6 +157,23 @@ class Account { return $userInfos[0]["ID_utilisateurs"]; } + /** + * Check whether an email address is linked to an account or not + * + * @return bool TRUE if the email is linked to an account / FALSE else + */ + public function exists_email(string $email) : bool { + + //Perform an API request + $tableName = self::USER_TABLE; + $conditions = "WHERE mail = ?"; + $values = array($email); + + //Return result + return CS::get()->db->count($tableName, $conditions, $values) > 0; + + } + /** * Crypt user password *