@unchainedshop/core-users 4.8.9 → 4.8.11
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/db/UsersCollection.js +51 -29
- package/lib/db/WebAuthnCredentialsCreationRequestsCollection.d.ts +1 -0
- package/lib/db/WebAuthnCredentialsCreationRequestsCollection.js +2 -5
- package/lib/module/configureUsersModule.js +1 -2
- package/lib/module/configureUsersWebAuthnModule.js +2 -0
- package/package.json +1 -1
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
import { buildDbIndexes,
|
|
1
|
+
import { buildDbIndexes, } from '@unchainedshop/mongodb';
|
|
2
2
|
export const UsersCollection = async (db) => {
|
|
3
3
|
const Users = db.collection('users');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'lastBillingAddress.addressLine2': 1,
|
|
28
|
-
},
|
|
29
|
-
name: 'user_fulltext_search',
|
|
4
|
+
await buildDbIndexes(Users, [
|
|
5
|
+
{
|
|
6
|
+
index: {
|
|
7
|
+
_id: 'text',
|
|
8
|
+
username: 'text',
|
|
9
|
+
'emails.address': 'text',
|
|
10
|
+
'profile.displayName': 'text',
|
|
11
|
+
'lastBillingAddress.firstName': 'text',
|
|
12
|
+
'lastBillingAddress.lastName': 'text',
|
|
13
|
+
'lastBillingAddress.company': 'text',
|
|
14
|
+
'lastBillingAddress.addressLine': 'text',
|
|
15
|
+
'lastBillingAddress.addressLine2': 'text',
|
|
16
|
+
},
|
|
17
|
+
options: {
|
|
18
|
+
weights: {
|
|
19
|
+
_id: 9,
|
|
20
|
+
'emails.address': 7,
|
|
21
|
+
'profile.displayName': 5,
|
|
22
|
+
'lastBillingAddress.firstName': 3,
|
|
23
|
+
'lastBillingAddress.lastName': 3,
|
|
24
|
+
'lastBillingAddress.company': 1,
|
|
25
|
+
'lastBillingAddress.addressLine': 1,
|
|
26
|
+
'lastBillingAddress.addressLine2': 1,
|
|
30
27
|
},
|
|
28
|
+
name: 'user_fulltext_search',
|
|
31
29
|
},
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
},
|
|
31
|
+
]);
|
|
34
32
|
await buildDbIndexes(Users, [
|
|
35
33
|
{
|
|
36
34
|
index: {
|
|
@@ -96,6 +94,30 @@ export const UsersCollection = async (db) => {
|
|
|
96
94
|
sparse: true,
|
|
97
95
|
},
|
|
98
96
|
},
|
|
97
|
+
{
|
|
98
|
+
index: {
|
|
99
|
+
'services.web3.verified': 1,
|
|
100
|
+
},
|
|
101
|
+
options: {
|
|
102
|
+
sparse: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
index: {
|
|
107
|
+
tags: 1,
|
|
108
|
+
},
|
|
109
|
+
options: {
|
|
110
|
+
sparse: true,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
index: {
|
|
115
|
+
'lastLogin.timestamp': 1,
|
|
116
|
+
},
|
|
117
|
+
options: {
|
|
118
|
+
sparse: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
99
121
|
]);
|
|
100
122
|
return Users;
|
|
101
123
|
};
|
|
@@ -2,11 +2,8 @@ import { buildDbIndexes } from '@unchainedshop/mongodb';
|
|
|
2
2
|
export const WebAuthnCredentialsCreationRequestsCollection = async (db) => {
|
|
3
3
|
const WebAuthnCredentialsCreationRequests = db.collection('accounts_webauthn_credentials_creation_requests');
|
|
4
4
|
await buildDbIndexes(WebAuthnCredentialsCreationRequests, [
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
username: 1,
|
|
8
|
-
},
|
|
9
|
-
},
|
|
5
|
+
{ index: { username: 1 } },
|
|
6
|
+
{ index: { created: 1 }, options: { expireAfterSeconds: 15 * 60 } },
|
|
10
7
|
]);
|
|
11
8
|
return WebAuthnCredentialsCreationRequests;
|
|
12
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as bcrypt from 'bcryptjs';
|
|
2
|
-
import { generateDbFilterById, buildSortOptions, generateDbObjectId, insensitiveTrimmedRegexOperator,
|
|
2
|
+
import { generateDbFilterById, buildSortOptions, generateDbObjectId, insensitiveTrimmedRegexOperator, } from '@unchainedshop/mongodb';
|
|
3
3
|
import { UsersCollection, } from "../db/UsersCollection.js";
|
|
4
4
|
import { emit, registerEvents } from '@unchainedshop/events';
|
|
5
5
|
import { systemLocale, SortDirection, sha256 } from '@unchainedshop/utils';
|
|
@@ -75,7 +75,6 @@ export const buildFindSelector = ({ includeGuests, includeDeleted, queryString,
|
|
|
75
75
|
selector['lastLogin.timestamp'].$gte = new Date(lastLogin.start);
|
|
76
76
|
}
|
|
77
77
|
if (queryString) {
|
|
78
|
-
assertDocumentDBCompatMode();
|
|
79
78
|
selector.$text = { $search: queryString };
|
|
80
79
|
}
|
|
81
80
|
return selector;
|
|
@@ -66,6 +66,7 @@ export const configureUsersWebAuthnModule = async ({ db }) => {
|
|
|
66
66
|
origin,
|
|
67
67
|
factor: 'either',
|
|
68
68
|
username,
|
|
69
|
+
created: new Date(),
|
|
69
70
|
});
|
|
70
71
|
return {
|
|
71
72
|
challenge,
|
|
@@ -98,6 +99,7 @@ export const configureUsersWebAuthnModule = async ({ db }) => {
|
|
|
98
99
|
origin,
|
|
99
100
|
factor: 'either',
|
|
100
101
|
username,
|
|
102
|
+
created: new Date(),
|
|
101
103
|
});
|
|
102
104
|
return {
|
|
103
105
|
challenge,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-users",
|
|
3
3
|
"description": "User management module for the Unchained Engine with authentication support",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.11",
|
|
5
5
|
"main": "lib/users-index.js",
|
|
6
6
|
"types": "lib/users-index.d.ts",
|
|
7
7
|
"type": "module",
|