mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
[web] Track if the email is confirmed/verified (#15818)
* Added email-verifed event * added email provider * check if the email is primary * rename confirm email segmentation * remove the segmentation because it duplicates verification-type * move the response * remove duplicate definition --------- Co-authored-by: Domagoj Kriskovic <dom.kriskovic@overleaf.com> GitOrigin-RevId: 2956467b46a883fc0ee00c26dd446ba82fa5be26
This commit is contained in:
committed by
Copybot
co-authored by
Domagoj Kriskovic
parent
441cf1bb5b
commit
fbf02b4856
@@ -295,7 +295,29 @@ const UserEmailsController = {
|
|||||||
'failed to add audit log entry'
|
'failed to add audit log entry'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
res.sendStatus(200)
|
UserGetter.getUser(
|
||||||
|
userData.userId,
|
||||||
|
{ email: 1 },
|
||||||
|
function (error, user) {
|
||||||
|
if (error) {
|
||||||
|
logger.error(
|
||||||
|
{ error, userId: userData.userId },
|
||||||
|
'failed to get user'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const isPrimary = user?.email === userData.email
|
||||||
|
AnalyticsManager.recordEventForUser(
|
||||||
|
userData.userId,
|
||||||
|
'email-verified',
|
||||||
|
{
|
||||||
|
provider: 'email',
|
||||||
|
verification_type: 'link',
|
||||||
|
isPrimary,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
res.sendStatus(200)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ describe('UserEmailsController', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.UserGetter = {
|
this.UserGetter = {
|
||||||
|
getUser: sinon.stub().yields(),
|
||||||
getUserFullEmails: sinon.stub(),
|
getUserFullEmails: sinon.stub(),
|
||||||
getUserByAnyEmail: sinon.stub(),
|
getUserByAnyEmail: sinon.stub(),
|
||||||
promises: {
|
promises: {
|
||||||
|
|||||||
Reference in New Issue
Block a user