Can check if a mail is linked to an account or not.

This commit is contained in:
Pierre 2018-04-11 11:19:37 +02:00
parent 43ba96ac5e
commit 259b8be3b5

View File

@ -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
*