@abtnode/auth 1.16.6-beta-4ea1eb90 → 1.16.6-beta-eaa4d39d
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/lib/auth.js +13 -8
- package/package.json +14 -14
package/lib/auth.js
CHANGED
|
@@ -466,6 +466,7 @@ const handleInvitationReceive = async ({
|
|
|
466
466
|
statusEndpointBaseUrl,
|
|
467
467
|
endpoint,
|
|
468
468
|
profile,
|
|
469
|
+
provider = 'wallet',
|
|
469
470
|
}) => {
|
|
470
471
|
if (!nodeInfo.nodeOwner) {
|
|
471
472
|
throw new Error(messages.notInitialized[locale]);
|
|
@@ -548,6 +549,8 @@ const handleInvitationReceive = async ({
|
|
|
548
549
|
throw new Error('not allowed to transfer application ownership');
|
|
549
550
|
}
|
|
550
551
|
|
|
552
|
+
// TODO: @zhanghan 判断方式应该是 userDid === nodeInfo.nodeOwner.did
|
|
553
|
+
// by @linchen
|
|
551
554
|
if (user && user.role === 'owner') {
|
|
552
555
|
throw new Error(messages.alreadyTransferred[locale](userDid));
|
|
553
556
|
}
|
|
@@ -571,7 +574,7 @@ const handleInvitationReceive = async ({
|
|
|
571
574
|
});
|
|
572
575
|
|
|
573
576
|
if (user) {
|
|
574
|
-
const doc = await node.
|
|
577
|
+
const doc = await node.loginUser({
|
|
575
578
|
teamDid,
|
|
576
579
|
user: {
|
|
577
580
|
...profile,
|
|
@@ -579,8 +582,7 @@ const handleInvitationReceive = async ({
|
|
|
579
582
|
did: userDid,
|
|
580
583
|
pk: userPk,
|
|
581
584
|
locale,
|
|
582
|
-
|
|
583
|
-
lastLoginAt: new Date().toISOString(),
|
|
585
|
+
passport,
|
|
584
586
|
lastLoginIp: get(req, 'headers[x-real-ip]') || '',
|
|
585
587
|
remark,
|
|
586
588
|
},
|
|
@@ -595,20 +597,22 @@ const handleInvitationReceive = async ({
|
|
|
595
597
|
node
|
|
596
598
|
);
|
|
597
599
|
} else {
|
|
598
|
-
const doc = await node.
|
|
600
|
+
const doc = await node.loginUser({
|
|
599
601
|
teamDid,
|
|
600
602
|
user: {
|
|
601
603
|
...profile,
|
|
602
604
|
avatar,
|
|
603
605
|
did: userDid,
|
|
604
606
|
pk: userPk,
|
|
605
|
-
approved: true,
|
|
606
607
|
locale,
|
|
607
|
-
|
|
608
|
-
firstLoginAt: new Date().toISOString(),
|
|
609
|
-
lastLoginAt: new Date().toISOString(),
|
|
608
|
+
passport,
|
|
610
609
|
lastLoginIp: get(req, 'headers[x-real-ip]') || '',
|
|
611
610
|
remark,
|
|
611
|
+
connectedAccount: {
|
|
612
|
+
provider,
|
|
613
|
+
did: userDid,
|
|
614
|
+
pk: userPk,
|
|
615
|
+
},
|
|
612
616
|
},
|
|
613
617
|
});
|
|
614
618
|
await node.createAuditLog(
|
|
@@ -675,6 +679,7 @@ const handleInvitationResponse = async ({
|
|
|
675
679
|
statusEndpointBaseUrl,
|
|
676
680
|
endpoint,
|
|
677
681
|
profile,
|
|
682
|
+
provider: 'wallet',
|
|
678
683
|
});
|
|
679
684
|
|
|
680
685
|
return receiveResult;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.6-beta-
|
|
6
|
+
"version": "1.16.6-beta-eaa4d39d",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/constant": "1.16.6-beta-
|
|
24
|
-
"@abtnode/logger": "1.16.6-beta-
|
|
25
|
-
"@abtnode/util": "1.16.6-beta-
|
|
26
|
-
"@arcblock/did": "1.18.
|
|
27
|
-
"@arcblock/jwt": "^1.18.
|
|
28
|
-
"@arcblock/vc": "1.18.
|
|
29
|
-
"@blocklet/constant": "1.16.6-beta-
|
|
30
|
-
"@blocklet/meta": "1.16.6-beta-
|
|
31
|
-
"@ocap/client": "1.18.
|
|
32
|
-
"@ocap/mcrypto": "1.18.
|
|
33
|
-
"@ocap/util": "1.18.
|
|
34
|
-
"@ocap/wallet": "1.18.
|
|
23
|
+
"@abtnode/constant": "1.16.6-beta-eaa4d39d",
|
|
24
|
+
"@abtnode/logger": "1.16.6-beta-eaa4d39d",
|
|
25
|
+
"@abtnode/util": "1.16.6-beta-eaa4d39d",
|
|
26
|
+
"@arcblock/did": "1.18.73",
|
|
27
|
+
"@arcblock/jwt": "^1.18.73",
|
|
28
|
+
"@arcblock/vc": "1.18.73",
|
|
29
|
+
"@blocklet/constant": "1.16.6-beta-eaa4d39d",
|
|
30
|
+
"@blocklet/meta": "1.16.6-beta-eaa4d39d",
|
|
31
|
+
"@ocap/client": "1.18.73",
|
|
32
|
+
"@ocap/mcrypto": "1.18.73",
|
|
33
|
+
"@ocap/util": "1.18.73",
|
|
34
|
+
"@ocap/wallet": "1.18.73",
|
|
35
35
|
"axios": "^0.27.2",
|
|
36
36
|
"joi": "17.7.0",
|
|
37
37
|
"jsonwebtoken": "^9.0.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"jest": "^27.5.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "0d2ab99f67109e989f8182fc70bc3ee9fa430585"
|
|
48
48
|
}
|