@jcbuisson/express-x 1.6.4 → 1.6.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.
- package/package.json +1 -1
- package/src/common-hooks.mjs +2 -1
- package/src/server.mjs +4 -3
package/package.json
CHANGED
package/src/common-hooks.mjs
CHANGED
|
@@ -6,7 +6,8 @@ import { getConnectionDataItem } from './context.mjs'
|
|
|
6
6
|
|
|
7
7
|
// hash password of user record
|
|
8
8
|
export const hashPassword = (passwordField) => async (context) => {
|
|
9
|
-
context.
|
|
9
|
+
// context.result is a user
|
|
10
|
+
context.result[passwordField] = await bcrypt.hash(context.result[passwordField], 5)
|
|
10
11
|
return context
|
|
11
12
|
}
|
|
12
13
|
|
package/src/server.mjs
CHANGED
|
@@ -32,7 +32,7 @@ export function expressX(prisma, options = {}) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
async function cloneConnection(id, connection) {
|
|
35
|
-
await prisma.Connection.update({
|
|
35
|
+
return await prisma.Connection.update({
|
|
36
36
|
where: { id },
|
|
37
37
|
data: {
|
|
38
38
|
clientIP: connection.clientIP,
|
|
@@ -362,11 +362,12 @@ export function expressX(prisma, options = {}) {
|
|
|
362
362
|
app.log('verbose', `cnx-transfer from ${from} to ${to}`)
|
|
363
363
|
const fromConnection = await getConnection(from)
|
|
364
364
|
if (!fromConnection) return
|
|
365
|
-
await cloneConnection(to, fromConnection)
|
|
365
|
+
const toConnection = await cloneConnection(to, fromConnection)
|
|
366
366
|
setSocket(to, socket)
|
|
367
367
|
await deleteConnection(from)
|
|
368
368
|
// send acknowledge to client
|
|
369
|
-
io.emit('cnx-transfer-ack',
|
|
369
|
+
// io.emit('cnx-transfer-ack', toConnection.data)
|
|
370
|
+
io.emit('cnx-transfer-ack', toConnection)
|
|
370
371
|
})
|
|
371
372
|
|
|
372
373
|
/*
|