@steedos/accounts 2.3.6 → 2.3.8
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,13 +6,12 @@ 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");
|
|
10
9
|
var registerPassword = function (accountsServer) { return function (req, res) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
11
10
|
var spaceId, codeRequired, password, inviteInfo, space, userId, foundedUser, result, enable_MFA, userProfile, err_1;
|
|
12
11
|
return tslib_1.__generator(this, function (_a) {
|
|
13
12
|
switch (_a.label) {
|
|
14
13
|
case 0:
|
|
15
|
-
_a.trys.push([0,
|
|
14
|
+
_a.trys.push([0, 11, , 12]);
|
|
16
15
|
spaceId = '';
|
|
17
16
|
if (req.body.spaceId) {
|
|
18
17
|
spaceId = req.body.spaceId;
|
|
@@ -49,35 +48,22 @@ var registerPassword = function (accountsServer) { return function (req, res) {
|
|
|
49
48
|
return [4, password.createUser(req.body)];
|
|
50
49
|
case 7:
|
|
51
50
|
userId = _a.sent();
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
if (inviteInfo && inviteInfo.space) {
|
|
52
|
+
Creator.addSpaceUsers(inviteInfo.space, userId, true);
|
|
53
|
+
}
|
|
54
|
+
else if (req.body.spaceId && space) {
|
|
55
|
+
Creator.addSpaceUsers(req.body.spaceId, userId, true);
|
|
56
|
+
}
|
|
57
|
+
return [4, password.findUserById(userId)];
|
|
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:
|
|
73
59
|
foundedUser = _a.sent();
|
|
74
60
|
return [4, accountsServer.loginWithUser(foundedUser, {})];
|
|
75
|
-
case
|
|
61
|
+
case 9:
|
|
76
62
|
result = _a.sent();
|
|
77
63
|
(0, steedos_auth_1.setAuthCookies)(req, res, result.user._id, result.token, result.tokens.accessToken);
|
|
78
64
|
enable_MFA = false;
|
|
79
65
|
return [4, password.getUserProfile(result.user._id)];
|
|
80
|
-
case
|
|
66
|
+
case 10:
|
|
81
67
|
userProfile = _a.sent();
|
|
82
68
|
if (userProfile) {
|
|
83
69
|
enable_MFA = userProfile.enable_MFA || false;
|
|
@@ -88,12 +74,12 @@ var registerPassword = function (accountsServer) { return function (req, res) {
|
|
|
88
74
|
}
|
|
89
75
|
}
|
|
90
76
|
res.json(result);
|
|
91
|
-
return [3,
|
|
92
|
-
case
|
|
77
|
+
return [3, 12];
|
|
78
|
+
case 11:
|
|
93
79
|
err_1 = _a.sent();
|
|
94
80
|
(0, send_error_1.sendError)(res, err_1);
|
|
95
|
-
return [3,
|
|
96
|
-
case
|
|
81
|
+
return [3, 12];
|
|
82
|
+
case 12: return [2];
|
|
97
83
|
}
|
|
98
84
|
});
|
|
99
85
|
}); }; };
|
|
@@ -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":"","sources":["../../../../src/rest-express/endpoints/password/register.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AI,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,EAvGmE,CAuGnE,CAAC;AAvGW,QAAA,gBAAgB,oBAuG3B"}
|
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.8",
|
|
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.8",
|
|
58
|
+
"@steedos/meteor-bundle-runner": "2.3.8",
|
|
59
|
+
"@steedos/objectql": "2.3.8",
|
|
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.8",
|
|
67
67
|
"typescript": "4.6.3"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b2393877080bbb08d758ce883522d37bc0a12ba2"
|
|
73
73
|
}
|
|
@@ -6,8 +6,7 @@ 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
|
-
|
|
10
|
-
import { getSteedosSchema } from '@steedos/objectql'
|
|
9
|
+
declare var Creator;
|
|
11
10
|
|
|
12
11
|
export const registerPassword = (accountsServer: AccountsServer) => async (
|
|
13
12
|
req: express.Request,
|
|
@@ -62,19 +61,9 @@ export const registerPassword = (accountsServer: AccountsServer) => async (
|
|
|
62
61
|
const userId = await password.createUser(req.body);
|
|
63
62
|
|
|
64
63
|
if(inviteInfo && inviteInfo.space){
|
|
65
|
-
|
|
66
|
-
await getSteedosSchema().broker.call(`spaces.addSpaceUsers`, {
|
|
67
|
-
spaceId: inviteInfo.space,
|
|
68
|
-
userId,
|
|
69
|
-
user_accepted: true,
|
|
70
|
-
})
|
|
64
|
+
Creator.addSpaceUsers(inviteInfo.space, userId, true)
|
|
71
65
|
}else if(req.body.spaceId && space){
|
|
72
|
-
|
|
73
|
-
await getSteedosSchema().broker.call(`spaces.addSpaceUsers`, {
|
|
74
|
-
spaceId: req.body.spaceId,
|
|
75
|
-
userId,
|
|
76
|
-
user_accepted: true,
|
|
77
|
-
})
|
|
66
|
+
Creator.addSpaceUsers(req.body.spaceId, userId, true)
|
|
78
67
|
}
|
|
79
68
|
|
|
80
69
|
const foundedUser = await password.findUserById(userId);
|