Can get account ID from email

This commit is contained in:
Pierre 2018-05-21 11:08:50 +02:00
parent 993319057a
commit fd73652589

View File

@ -198,6 +198,30 @@ class AccountComponent {
} }
/**
* Get the ID of the account associated with an email address
*
* @param string $email The email address
* @return int The ID of the account / -1 in case of failure
*/
public function getIDfromEmail(string $email): int {
//Perform an API request
$tableName = self::USER_TABLE;
$conditions = "WHERE mail = ?";
$values = array($email);
//Peform the request
$values = cs()->db->select($tableName, $conditions, $values);
if(count($values) == 0)
return -1; //No result found
//Return first value
return $values[0]["ID"];
}
/** /**
* Intend to create an account * Intend to create an account
* *