mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
send confirmation email to pending user
This commit is contained in:
parent
7293469468
commit
1ea34bde62
1 changed files with 17 additions and 0 deletions
|
|
@ -9,6 +9,9 @@ import { Invite } from '../entity/groups/invite'
|
|||
import { GroupMembership } from '../entity/groups/group_membership'
|
||||
import { AppDataSource } from '../server'
|
||||
import { getRepository } from '../entity/utils'
|
||||
import { generateVerificationToken } from '../utils/auth'
|
||||
import { env } from '../env'
|
||||
import { sendEmail } from '../utils/sendEmail'
|
||||
|
||||
export const createUser = async (input: {
|
||||
provider: AuthProvider
|
||||
|
|
@ -90,6 +93,20 @@ export const createUser = async (input: {
|
|||
}
|
||||
)
|
||||
|
||||
// send confirmation email
|
||||
if (input.pendingConfirmation) {
|
||||
// generate confirmation link
|
||||
const confirmationToken = generateVerificationToken(user.id)
|
||||
const confirmationLink = `${env.client.url}/confirm-email/${confirmationToken}`
|
||||
// send email
|
||||
await sendEmail({
|
||||
from: env.sender.message,
|
||||
to: user.email,
|
||||
subject: 'Confirm your email',
|
||||
text: `Please confirm your email by clicking the link below:\n\n${confirmationLink}\n\n`,
|
||||
})
|
||||
}
|
||||
|
||||
return [user, profile]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue