mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 13:59:29 +00:00
Limit the number of account / hour / ip
This commit is contained in:
parent
5bddd624ca
commit
4937e66c71
@ -225,6 +225,8 @@ class accountController {
|
||||
*/
|
||||
public function createAccount(){
|
||||
|
||||
api_limit_query(APILimits::ACTION_CREATE_ACCOUNT, false);
|
||||
|
||||
//Check post fields existence
|
||||
if(!check_post_parametres(array("emailAddress", "firstName", "lastName", "password")))
|
||||
Rest_fatal_error(400, "Please check given parameters");
|
||||
@ -261,6 +263,8 @@ class accountController {
|
||||
if(!components()->account->create($newAccount))
|
||||
Rest_fatal_error(500, "An error occured while trying to create the account !");
|
||||
|
||||
api_limit_query(APILimits::ACTION_CREATE_ACCOUNT, true);
|
||||
|
||||
//Success
|
||||
return array(
|
||||
"success" => "The account has been created !"
|
||||
|
@ -21,6 +21,7 @@ class APILimits {
|
||||
* Actions list
|
||||
*/
|
||||
const ACTION_LOGIN_FAILED = "failed_login";
|
||||
const ACTION_CREATE_ACCOUNT = "create_account";
|
||||
|
||||
/**
|
||||
* Actions configruation
|
||||
@ -30,7 +31,12 @@ class APILimits {
|
||||
//Login failed
|
||||
self::ACTION_LOGIN_FAILED => array(
|
||||
"limit" => 10
|
||||
)
|
||||
),
|
||||
|
||||
//Create an account
|
||||
self::ACTION_CREATE_ACCOUNT => array(
|
||||
"limit" => 10
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user