backend-manager 3.0.58 → 3.0.59
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,4 +1,5 @@
|
|
|
1
|
-
const _ = require('lodash')
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const fetch = require('wonderful-fetch');
|
|
2
3
|
|
|
3
4
|
function Module() {
|
|
4
5
|
|
|
@@ -22,6 +23,29 @@ Module.prototype.main = function () {
|
|
|
22
23
|
return reject(assistant.errorManager(`This account cannot be deleted because it has a paid subscription attached to it. In order to delete the account, you must first cancel the paid subscription.`, {code: 400, sentry: false, send: false, log: false}).error)
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
// Signout of all sessions
|
|
27
|
+
assistant.log(`Signout of all sessions...`);
|
|
28
|
+
await fetch(`https://us-central1-${self.Manager.project.projectId}.cloudfunctions.net/bm_api`, {
|
|
29
|
+
method: 'post',
|
|
30
|
+
timeout: 30000,
|
|
31
|
+
response: 'json',
|
|
32
|
+
tries: 2,
|
|
33
|
+
log: true,
|
|
34
|
+
body: {
|
|
35
|
+
backendManagerKey: self.Manager.config.backend_manager.key,
|
|
36
|
+
command: 'user:sign-out-all-sessions',
|
|
37
|
+
payload: {
|
|
38
|
+
uid: user.uid,
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
.then((json) => {
|
|
43
|
+
assistant.log(`Signout of all sessions success`, json);
|
|
44
|
+
})
|
|
45
|
+
.catch(e => {
|
|
46
|
+
assistant.error(`Signout of all sessions failed`, e);
|
|
47
|
+
})
|
|
48
|
+
|
|
25
49
|
// Perform the delete
|
|
26
50
|
await self.libraries.admin.auth().deleteUser(_.get(user, 'auth.uid', null))
|
|
27
51
|
.then(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _ = require('lodash')
|
|
2
|
-
const fetch = require('
|
|
2
|
+
const fetch = require('wonderful-fetch');
|
|
3
3
|
|
|
4
4
|
const MAX_SIGNUPS = 3;
|
|
5
5
|
const MAX_AGE = 30;
|
|
@@ -239,17 +239,17 @@ function addToMCList(key, listId, email) {
|
|
|
239
239
|
let datacenter = key.split('-')[1];
|
|
240
240
|
fetch(`https://${datacenter}.api.mailchimp.com/3.0/lists/${listId}/members`, {
|
|
241
241
|
method: 'post',
|
|
242
|
-
|
|
242
|
+
timeout: 30000,
|
|
243
|
+
response: 'json',
|
|
244
|
+
body: {
|
|
243
245
|
email_address: email,
|
|
244
246
|
status: 'subscribed',
|
|
245
|
-
}
|
|
246
|
-
timeout: 10000,
|
|
247
|
+
},
|
|
247
248
|
headers: {
|
|
248
249
|
'Content-Type': 'application/json',
|
|
249
250
|
'Authorization': `Basic ${key}`,
|
|
250
251
|
},
|
|
251
252
|
})
|
|
252
|
-
.then(res => res.json())
|
|
253
253
|
.then(json => {
|
|
254
254
|
if (json.status !== 'subscribed') {
|
|
255
255
|
return reject(new Error(json.status));
|
|
@@ -47,29 +47,6 @@ Module.prototype.main = function () {
|
|
|
47
47
|
assistant.error(`Delete user record failed`, e);
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
// Signout of all sessions
|
|
51
|
-
assistant.log(`Signout of all sessions...`);
|
|
52
|
-
await fetch(`https://us-central1-${self.Manager.project.projectId}.cloudfunctions.net/bm_api`, {
|
|
53
|
-
method: 'post',
|
|
54
|
-
timeout: 30000,
|
|
55
|
-
response: 'json',
|
|
56
|
-
tries: 2,
|
|
57
|
-
log: true,
|
|
58
|
-
body: {
|
|
59
|
-
backendManagerKey: self.Manager.config.backend_manager.key,
|
|
60
|
-
command: 'user:sign-out-all-sessions',
|
|
61
|
-
payload: {
|
|
62
|
-
uid: user.uid,
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
})
|
|
66
|
-
.then((json) => {
|
|
67
|
-
assistant.log(`Signout of all sessions success`, json);
|
|
68
|
-
})
|
|
69
|
-
.catch(e => {
|
|
70
|
-
assistant.error(`Signout of all sessions failed`, e);
|
|
71
|
-
})
|
|
72
|
-
|
|
73
50
|
// Update user count
|
|
74
51
|
assistant.log(`Decrement user count...`);
|
|
75
52
|
await libraries.admin.firestore().doc(`meta/stats`)
|