@unchainedshop/core-users 4.9.0 → 4.9.2
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.
|
@@ -89,6 +89,11 @@ export const configureUsersModule = async (moduleInput) => {
|
|
|
89
89
|
registerEvents(USER_EVENTS);
|
|
90
90
|
const Users = await UsersCollection(db);
|
|
91
91
|
const webAuthn = await configureUsersWebAuthnModule(moduleInput);
|
|
92
|
+
const deleteUserSessions = async (userId) => {
|
|
93
|
+
await db.collection('sessions').deleteMany({
|
|
94
|
+
session: { $regex: `"user(Id)?":"${escapeRegexString(userId)}"` },
|
|
95
|
+
});
|
|
96
|
+
};
|
|
92
97
|
const assertAnotherActiveAdminExists = async (userId) => {
|
|
93
98
|
const user = await Users.findOne({ _id: userId, deleted: null });
|
|
94
99
|
if (!user?.roles?.includes(ADMIN_ROLE))
|
|
@@ -536,6 +541,7 @@ export const configureUsersModule = async (moduleInput) => {
|
|
|
536
541
|
}, { returnDocument: 'after' });
|
|
537
542
|
if (!user)
|
|
538
543
|
return null;
|
|
544
|
+
await deleteUserSessions(userId);
|
|
539
545
|
await emit('USER_UPDATE_PASSWORD', {
|
|
540
546
|
user: removeConfidentialServiceHashes(user),
|
|
541
547
|
});
|
|
@@ -616,9 +622,7 @@ export const configureUsersModule = async (moduleInput) => {
|
|
|
616
622
|
},
|
|
617
623
|
markDeleted: async (userId) => {
|
|
618
624
|
await assertAnotherActiveAdminExists(userId);
|
|
619
|
-
await
|
|
620
|
-
session: { $regex: `"user(Id)?":"${escapeRegexString(userId)}"` },
|
|
621
|
-
});
|
|
625
|
+
await deleteUserSessions(userId);
|
|
622
626
|
const user = await Users.findOneAndUpdate({ _id: userId }, {
|
|
623
627
|
$set: {
|
|
624
628
|
username: `deleted-${Date.now()}`,
|
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.9.
|
|
4
|
+
"version": "4.9.2",
|
|
5
5
|
"main": "lib/users-index.js",
|
|
6
6
|
"types": "lib/users-index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@noble/curves": "^2.4.0",
|
|
59
59
|
"@noble/hashes": "^2.4.0",
|
|
60
|
-
"@types/node": "^26.6.
|
|
60
|
+
"@types/node": "^26.6.6",
|
|
61
61
|
"typescript": "^6.0.3"
|
|
62
62
|
}
|
|
63
63
|
}
|