mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Added a method to check if an email is associated or not with an account.
This commit is contained in:
parent
f3392db596
commit
c44ee1cb1b
@ -62,6 +62,26 @@ class accountController {
|
||||
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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user