mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 03:21:56 +02:00
Fix invitation resend
This commit is contained in:
@@ -125,7 +125,7 @@ templates.verifyEmailToJoinTeam =
|
||||
type:"notification"
|
||||
plainTextTemplate: _.template """
|
||||
|
||||
Please click the button below to join the team and enjoy the benefits of an upgraded <%= settings.appName %> account.
|
||||
Please click the button below to join the team and enjoy the benefits of an upgraded <%= appName %> account.
|
||||
|
||||
<%= acceptInviteUrl %>
|
||||
|
||||
|
||||
@@ -86,12 +86,15 @@ createInvite = (subscription, email, inviterName, callback) ->
|
||||
invite = subscription.teamInvites.find (invite) -> invite.email == email
|
||||
|
||||
if !invite?
|
||||
invite ||= { email: email }
|
||||
invite = {
|
||||
email: email
|
||||
inviterName: inviterName
|
||||
token: crypto.randomBytes(32).toString("hex")
|
||||
sentAt: new Date()
|
||||
}
|
||||
subscription.teamInvites.push(invite)
|
||||
|
||||
invite.inviterName = inviterName
|
||||
invite.token = crypto.randomBytes(32).toString("hex")
|
||||
invite.sentAt = new Date()
|
||||
else
|
||||
invite.sentAt = new Date()
|
||||
|
||||
subscription.save (error) ->
|
||||
return callback(error) if error?
|
||||
@@ -100,6 +103,7 @@ createInvite = (subscription, email, inviterName, callback) ->
|
||||
to: email
|
||||
inviterName: inviterName
|
||||
acceptInviteUrl: "#{settings.siteUrl}/subscription/invites/#{invite.token}/"
|
||||
appName: settings.appName
|
||||
EmailHandler.sendEmail "verifyEmailToJoinTeam", opts, (error) ->
|
||||
return callback(error, invite)
|
||||
|
||||
|
||||
@@ -127,7 +127,6 @@ describe "TeamInvitesHandler", ->
|
||||
expect(@subscription.teamInvites).to.deep.include invite
|
||||
|
||||
expect(invite.email).to.eq originalInvite.email
|
||||
expect(invite.token).not.to.eq originalInvite.token
|
||||
|
||||
@subscription.save.calledOnce.should.eq true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user