backend-manager 3.0.19 → 3.0.20
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
|
const { get, merge } = require('lodash');
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
|
|
3
|
+
const ERROR_TOO_MANY_ATTEMPTS = 'You have created too many accounts with our service. Please try again later.';
|
|
4
4
|
|
|
5
5
|
function Module() {
|
|
6
6
|
const self = this;
|
|
@@ -34,7 +34,7 @@ Module.prototype.main = function () {
|
|
|
34
34
|
// if (context.additionalUserInfo.recaptchaScore < 0.5) {
|
|
35
35
|
// assistant.error(`Recaptcha score (${context.additionalUserInfo.recaptchaScore}) too low for ${user.uid}`, { environment: 'production' });
|
|
36
36
|
|
|
37
|
-
// throw new functions.auth.HttpsError('resource-exhausted');
|
|
37
|
+
// throw new functions.auth.HttpsError('resource-exhausted', ERROR_TOO_MANY_ATTEMPTS);
|
|
38
38
|
// }
|
|
39
39
|
|
|
40
40
|
const ipAddress = context.ipAddress;
|
|
@@ -51,7 +51,7 @@ Module.prototype.main = function () {
|
|
|
51
51
|
if (currentTime - lastTime < oneHour && count >= 2) {
|
|
52
52
|
assistant.error(`Too many attemps to create an account for ${ipAddress}`, { environment: 'production' });
|
|
53
53
|
|
|
54
|
-
throw new functions.auth.HttpsError('resource-exhausted');
|
|
54
|
+
throw new functions.auth.HttpsError('resource-exhausted', ERROR_TOO_MANY_ATTEMPTS);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Update rate-limiting data
|
|
@@ -66,7 +66,7 @@ Module.prototype.main = function () {
|
|
|
66
66
|
if (existingAccount instanceof Error) {
|
|
67
67
|
assistant.error(`Failed to get existing account ${user.uid}:`, existingAccount, { environment: 'production' });
|
|
68
68
|
|
|
69
|
-
throw new functions.auth.HttpsError('internal');
|
|
69
|
+
throw new functions.auth.HttpsError('internal', `Failed to get existing account: ${existingAccount}`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
let account = {
|
|
@@ -111,7 +111,7 @@ Module.prototype.main = function () {
|
|
|
111
111
|
if (update instanceof Error) {
|
|
112
112
|
assistant.error(`Failed to update user ${user.uid}:`, update, { environment: 'production' });
|
|
113
113
|
|
|
114
|
-
throw new functions.auth.HttpsError('internal');
|
|
114
|
+
throw new functions.auth.HttpsError('internal', `Failed to update user: ${update}`);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
assistant.log(`User created at users/${user.uid}`, account, { environment: 'production' });
|
|
@@ -51,7 +51,7 @@ Module.prototype.main = function () {
|
|
|
51
51
|
if (update instanceof Error) {
|
|
52
52
|
assistant.error(`Failed to update user ${user.uid}:`, update, { environment: 'production' });
|
|
53
53
|
|
|
54
|
-
throw new functions.auth.HttpsError('internal');
|
|
54
|
+
throw new functions.auth.HttpsError('internal', `Failed to update user: ${update}`);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
assistant.log(`Updated user activity`, {environment: 'production'});
|