Added a method to check if an email is associated or not with an account.

This commit is contained in:
Pierre 2018-05-21 10:27:07 +02:00
parent f3392db596
commit c44ee1cb1b

View File

@ -62,6 +62,26 @@ class accountController {
return array("success" => "The user has been disconnected !"); return array("success" => "The user has been disconnected !");
} }
/**
* Check if an email is already associated with an account or not
*
* @url POST /account/exists_email
*/
public function existsMail(){
//Check the given email address
$email = postString("email", 5);
if(!filter_var($email, FILTER_VALIDATE_EMAIL))
Rest_fatal_error(400, "Specified email address is invalid !");
//Check if the email address is already associated with an account
$email_exists = components()->account->exists_email($email);
return array(
"exists" => $email_exists
);
}
/** /**
* Create an account * Create an account
* *