backend-manager 2.5.73 → 2.5.74
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": "2.5.
|
|
3
|
+
"version": "2.5.74",
|
|
4
4
|
"description": "Quick tools for developing Firebase functions",
|
|
5
5
|
"main": "src/manager/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"wonderful-fetch": "^0.0.17",
|
|
63
63
|
"yargs": "^17.7.1"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|
|
@@ -15,6 +15,21 @@ Module.prototype.main = function () {
|
|
|
15
15
|
return new Promise(async function(resolve, reject) {
|
|
16
16
|
self.Api.resolveUser({adminRequired: true})
|
|
17
17
|
.then(async (user) => {
|
|
18
|
+
// Get auth user from firebase
|
|
19
|
+
const authUser = await self.libraries.admin.auth().getUser(user.auth.uid).catch(e => e);
|
|
20
|
+
|
|
21
|
+
if (authUser instanceof Error) {
|
|
22
|
+
return reject(assistant.errorManager(`Failed to get auth user: ${authUser}`, {code: 500, sentry: false, send: false, log: false}).error)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Difference in hours
|
|
26
|
+
const diff = (Date.now() - new Date(authUser.metadata.creationTime)) / 36e5;
|
|
27
|
+
|
|
28
|
+
// If the user is not new, reject
|
|
29
|
+
if (diff > 0.5) {
|
|
30
|
+
return reject(assistant.errorManager(`User is not new.`, {code: 400, sentry: false, send: false, log: false}).error)
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
await self.signUp({
|
|
19
34
|
auth: {
|
|
20
35
|
uid: _.get(user, 'auth.uid', null),
|