Admin tools, Authentication: Fix: set analyticsId when creating a new user

This commit is contained in:
Pierpaolo Vittorini
2026-09-22 02:41:42 +02:00
committed by yu-i-i
parent f71de2eacc
commit 24e2fdaab5
4 changed files with 7 additions and 0 deletions
@@ -116,6 +116,7 @@ async function registerNewUser(req, res, next) {
}
delete req.body.isExternal
req.body.password = crypto.randomBytes(32).toString('hex')
req.body.analyticsId = crypto.randomUUID()
let user
try {
@@ -1,3 +1,4 @@
import crypto from 'node:crypto'
import Settings from '@overleaf/settings'
import UserCreator from '../../../../../app/src/Features/User/UserCreator.mjs'
import { ParallelLoginError } from '../../../../../app/src/Features/Authentication/AuthenticationErrors.mjs'
@@ -42,6 +43,7 @@ const LDAPAuthenticationManager = {
last_name: lastName,
isAdmin: isAdmin,
holdingAccount: false,
analyticsId: crypto.randomUUID(),
}
)
await User.updateOne(
@@ -1,3 +1,4 @@
import crypto from 'node:crypto'
import Settings from '@overleaf/settings'
import UserCreator from '../../../../../app/src/Features/User/UserCreator.mjs'
import ThirdPartyIdentityManager from '../../../../../app/src/Features/User/ThirdPartyIdentityManager.mjs'
@@ -58,6 +59,7 @@ const OIDCAuthenticationManager = {
last_name: lastName,
isAdmin: isAdmin,
holdingAccount: false,
analyticsId: crypto.randomUUID(),
}
)
}
@@ -1,3 +1,4 @@
import crypto from 'node:crypto'
import Settings from '@overleaf/settings'
import UserCreator from '../../../../../app/src/Features/User/UserCreator.mjs'
import { ParallelLoginError } from '../../../../../app/src/Features/Authentication/AuthenticationErrors.mjs'
@@ -43,6 +44,7 @@ const SAMLAuthenticationManager = {
isAdmin: isAdmin,
holdingAccount: false,
samlIdentifiers: [{ providerId: providerId }],
analyticsId: crypto.randomUUID(),
}
)
}