@steedos/accounts 2.3.5 → 2.3.6
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.
|
@@ -6,12 +6,13 @@ var send_error_1 = require("../../utils/send-error");
|
|
|
6
6
|
var core_1 = require("../../../core");
|
|
7
7
|
var steedos_auth_1 = require("../../utils/steedos-auth");
|
|
8
8
|
var db_1 = require("../../../db");
|
|
9
|
+
var objectql_1 = require("@steedos/objectql");
|
|
9
10
|
var registerPassword = function (accountsServer) { return function (req, res) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
10
11
|
var spaceId, codeRequired, password, inviteInfo, space, userId, foundedUser, result, enable_MFA, userProfile, err_1;
|
|
11
12
|
return tslib_1.__generator(this, function (_a) {
|
|
12
13
|
switch (_a.label) {
|
|
13
14
|
case 0:
|
|
14
|
-
_a.trys.push([0,
|
|
15
|
+
_a.trys.push([0, 15, , 16]);
|
|
15
16
|
spaceId = '';
|
|
16
17
|
if (req.body.spaceId) {
|
|
17
18
|
spaceId = req.body.spaceId;
|
|
@@ -48,22 +49,35 @@ var registerPassword = function (accountsServer) { return function (req, res) {
|
|
|
48
49
|
return [4, password.createUser(req.body)];
|
|
49
50
|
case 7:
|
|
50
51
|
userId = _a.sent();
|
|
51
|
-
if (inviteInfo && inviteInfo.space)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return [4, password.findUserById(userId)];
|
|
52
|
+
if (!(inviteInfo && inviteInfo.space)) return [3, 9];
|
|
53
|
+
return [4, (0, objectql_1.getSteedosSchema)().broker.call("spaces.addSpaceUsers", {
|
|
54
|
+
spaceId: inviteInfo.space,
|
|
55
|
+
userId: userId,
|
|
56
|
+
user_accepted: true,
|
|
57
|
+
})];
|
|
58
58
|
case 8:
|
|
59
|
+
_a.sent();
|
|
60
|
+
return [3, 11];
|
|
61
|
+
case 9:
|
|
62
|
+
if (!(req.body.spaceId && space)) return [3, 11];
|
|
63
|
+
return [4, (0, objectql_1.getSteedosSchema)().broker.call("spaces.addSpaceUsers", {
|
|
64
|
+
spaceId: req.body.spaceId,
|
|
65
|
+
userId: userId,
|
|
66
|
+
user_accepted: true,
|
|
67
|
+
})];
|
|
68
|
+
case 10:
|
|
69
|
+
_a.sent();
|
|
70
|
+
_a.label = 11;
|
|
71
|
+
case 11: return [4, password.findUserById(userId)];
|
|
72
|
+
case 12:
|
|
59
73
|
foundedUser = _a.sent();
|
|
60
74
|
return [4, accountsServer.loginWithUser(foundedUser, {})];
|
|
61
|
-
case
|
|
75
|
+
case 13:
|
|
62
76
|
result = _a.sent();
|
|
63
77
|
(0, steedos_auth_1.setAuthCookies)(req, res, result.user._id, result.token, result.tokens.accessToken);
|
|
64
78
|
enable_MFA = false;
|
|
65
79
|
return [4, password.getUserProfile(result.user._id)];
|
|
66
|
-
case
|
|
80
|
+
case 14:
|
|
67
81
|
userProfile = _a.sent();
|
|
68
82
|
if (userProfile) {
|
|
69
83
|
enable_MFA = userProfile.enable_MFA || false;
|
|
@@ -74,12 +88,12 @@ var registerPassword = function (accountsServer) { return function (req, res) {
|
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
res.json(result);
|
|
77
|
-
return [3,
|
|
78
|
-
case
|
|
91
|
+
return [3, 16];
|
|
92
|
+
case 15:
|
|
79
93
|
err_1 = _a.sent();
|
|
80
94
|
(0, send_error_1.sendError)(res, err_1);
|
|
81
|
-
return [3,
|
|
82
|
-
case
|
|
95
|
+
return [3, 16];
|
|
96
|
+
case 16: return [2];
|
|
83
97
|
}
|
|
84
98
|
});
|
|
85
99
|
}); }; };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../src/rest-express/endpoints/password/register.ts"],"names":[],"mappings":";;;;AAGA,qDAAmD;AAEnD,sCAA2D;AAC3D,yDAA0D;AAC1D,kCAAiC;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"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AAC;gBAC/E,UAAU,GAAG,KAAK,CAAC;gBAEH,WAAM,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAA;;gBAA5D,WAAW,GAAG,SAA8C;gBAClE,IAAG,WAAW,EAAC;oBACb,UAAU,GAAG,WAAW,CAAC,UAAU,IAAI,KAAK,CAAA;iBAC7C;gBAED,IAAG,UAAU,EAAC;oBAEZ,IAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAC;wBACtB,MAAM,CAAC,KAAK,GAAG,kBAAkB,CAAC;qBACnC;iBACF;gBAED,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;;;;gBAyBhB,IAAA,sBAAS,EAAC,GAAG,EAAE,KAAG,CAAC,CAAC;;;;;KAEvB,EAjHmE,CAiHnE,CAAC;AAjHW,QAAA,gBAAgB,oBAiH3B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/accounts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.6",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"/package.json",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
"validator": "^13.6.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@steedos/auth": "2.3.
|
|
58
|
-
"@steedos/meteor-bundle-runner": "2.3.
|
|
59
|
-
"@steedos/objectql": "2.3.
|
|
57
|
+
"@steedos/auth": "2.3.6",
|
|
58
|
+
"@steedos/meteor-bundle-runner": "2.3.6",
|
|
59
|
+
"@steedos/objectql": "2.3.6",
|
|
60
60
|
"@types/dotenv-flow": "^3.0.0",
|
|
61
61
|
"@types/node": "12.6.8",
|
|
62
62
|
"cross-env": "^7.0.3",
|
|
63
63
|
"dotenv": "^8.2.0",
|
|
64
64
|
"dotenv-flow": "^3.1.0",
|
|
65
65
|
"nodemon": "^2.0.19",
|
|
66
|
-
"steedos-server": "2.3.
|
|
66
|
+
"steedos-server": "2.3.6",
|
|
67
67
|
"typescript": "4.6.3"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "3ef6bf3744c616d6a961b3264e5f204b9697ef6a"
|
|
73
73
|
}
|
|
@@ -6,7 +6,8 @@ import { errors } from '../../../password/errors';
|
|
|
6
6
|
import { canRegister, loginWithCode } from '../../../core';
|
|
7
7
|
import { setAuthCookies } from '../../utils/steedos-auth';
|
|
8
8
|
import { db } from '../../../db';
|
|
9
|
-
declare var Creator;
|
|
9
|
+
// declare var Creator;
|
|
10
|
+
import { getSteedosSchema } from '@steedos/objectql'
|
|
10
11
|
|
|
11
12
|
export const registerPassword = (accountsServer: AccountsServer) => async (
|
|
12
13
|
req: express.Request,
|
|
@@ -61,9 +62,19 @@ export const registerPassword = (accountsServer: AccountsServer) => async (
|
|
|
61
62
|
const userId = await password.createUser(req.body);
|
|
62
63
|
|
|
63
64
|
if(inviteInfo && inviteInfo.space){
|
|
64
|
-
Creator.addSpaceUsers(inviteInfo.space, userId, true)
|
|
65
|
+
// Creator.addSpaceUsers(inviteInfo.space, userId, true)
|
|
66
|
+
await getSteedosSchema().broker.call(`spaces.addSpaceUsers`, {
|
|
67
|
+
spaceId: inviteInfo.space,
|
|
68
|
+
userId,
|
|
69
|
+
user_accepted: true,
|
|
70
|
+
})
|
|
65
71
|
}else if(req.body.spaceId && space){
|
|
66
|
-
Creator.addSpaceUsers(req.body.spaceId, userId, true)
|
|
72
|
+
// Creator.addSpaceUsers(req.body.spaceId, userId, true)
|
|
73
|
+
await getSteedosSchema().broker.call(`spaces.addSpaceUsers`, {
|
|
74
|
+
spaceId: req.body.spaceId,
|
|
75
|
+
userId,
|
|
76
|
+
user_accepted: true,
|
|
77
|
+
})
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
const foundedUser = await password.findUserById(userId);
|