backend-manager 3.0.48 → 3.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.0.48",
3
+ "version": "3.0.49",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -1,6 +1,9 @@
1
1
  const _ = require('lodash')
2
2
  const fetch = require('node-fetch');
3
3
 
4
+ const MAX_SIGNUPS = 3;
5
+ const MAX_AGE = 3;
6
+
4
7
  function Module() {
5
8
 
6
9
  }
@@ -29,15 +32,18 @@ Module.prototype.main = function () {
29
32
  const ageInMinutes = (Date.now() - new Date(authUser.metadata.creationTime)) / 1000 / 60;
30
33
 
31
34
  // If the user is not new, reject
32
- if (ageInMinutes > 3) {
35
+ if (ageInMinutes >= MAX_AGE) {
33
36
  return reject(assistant.errorManager(`User is not new.`, {code: 400, sentry: false, send: false, log: false}).error)
34
37
  }
35
38
 
36
39
  // Check if IP has signed up too many times
37
40
  const signups = usage.getUsage('signups');
38
41
 
42
+ // Log the signup
43
+ usage.log(`Validating signups ${signups}/${MAX_SIGNUPS}`,);
44
+
39
45
  // If over limit, reject and delete the user
40
- if (signups >= 3) {
46
+ if (signups >= MAX_SIGNUPS) {
41
47
  await Api.import('user:delete')
42
48
  .then(async (lib) => {
43
49
  await lib.main().catch(e => e);