1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Limit the create account requests

This commit is contained in:
Pierre HUBERT 2020-03-25 18:06:42 +01:00
parent ea99796edf
commit f27ffe5d43

View File

@ -20,7 +20,8 @@ export class AccountController {
* @param h Request handler * @param h Request handler
*/ */
public static async Create(h: RequestHandler) { public static async Create(h: RequestHandler) {
// TODO : add API limit // Limit request
await limit_query(h, Action.CREATE_ACCOUNT, false);
// Get & check email address // Get & check email address
const email = h.postEmail("emailAddress"); const email = h.postEmail("emailAddress");
@ -37,7 +38,8 @@ export class AccountController {
// Try to create the account // Try to create the account
await AccountHelper.Create(newAccount); await AccountHelper.Create(newAccount);
// TODO : trigger the API limit // Trigger the API limit
await limit_query(h, Action.CREATE_ACCOUNT, true);
// Success // Success
h.success("The account has been created!"); h.success("The account has been created!");