mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #30835 from overleaf/ii-domain-capture-invite-token
[web] Create invite token when domain capture is disabled GitOrigin-RevId: 193b5b8567c3b593c98f432568b47cc4e9e17339
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import crypto from 'node:crypto'
|
||||
import settings from '@overleaf/settings'
|
||||
import logger from '@overleaf/logger'
|
||||
import OError from '@overleaf/o-error'
|
||||
@@ -280,6 +281,11 @@ async function resendInvite(req, res, next) {
|
||||
)?.[0]
|
||||
acceptInviteUrl = `${settings.siteUrl}${samlInitPath}`
|
||||
} else {
|
||||
if (!currentInvite.token) {
|
||||
currentInvite.token = crypto.randomBytes(32).toString('hex')
|
||||
currentInvite.domainCapture = false
|
||||
await subscription.save()
|
||||
}
|
||||
acceptInviteUrl = `${settings.siteUrl}/subscription/invites/${currentInvite.token}/`
|
||||
}
|
||||
|
||||
|
||||
@@ -233,8 +233,11 @@ async function _createInvite(subscription, email, inviter, auditLog) {
|
||||
let invite = subscription.teamInvites.find(invite => invite.email === email)
|
||||
|
||||
if (invite) {
|
||||
invite = invite.toObject()
|
||||
invite.sentAt = new Date()
|
||||
if (!invite.token && !domainCaptureEnabled) {
|
||||
invite.token = crypto.randomBytes(32).toString('hex')
|
||||
invite.domainCapture = false
|
||||
}
|
||||
} else {
|
||||
if (domainCaptureEnabled) {
|
||||
invite = {
|
||||
|
||||
Reference in New Issue
Block a user