mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add redeemCode on register process for createUser
This commit is contained in:
parent
3992882962
commit
15e0186381
@ -367,11 +367,15 @@ export class UserResolver {
|
||||
// TODO: this has duplicate code with sendResetPasswordEmail
|
||||
const emailOptIn = await createEmailOptIn(dbUser.id, queryRunner)
|
||||
|
||||
const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(
|
||||
let activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(
|
||||
/{code}/g,
|
||||
emailOptIn.verificationCode.toString(),
|
||||
)
|
||||
|
||||
if (redeemCode !== '') {
|
||||
activationLink += '/' + redeemCode
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const emailSent = await sendAccountActivationEmail({
|
||||
link: activationLink,
|
||||
@ -380,13 +384,13 @@ export class UserResolver {
|
||||
email,
|
||||
})
|
||||
|
||||
/* uncomment this, when you need the activation link on the console
|
||||
// uncomment this, when you need the activation link on the console
|
||||
// In case EMails are disabled log the activation link for the user
|
||||
if (!emailSent) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Account confirmation link: ${activationLink}`)
|
||||
}
|
||||
*/
|
||||
|
||||
await queryRunner.commitTransaction()
|
||||
} catch (e) {
|
||||
await queryRunner.rollbackTransaction()
|
||||
|
||||
@ -45,6 +45,7 @@ export const createUser = gql`
|
||||
$email: String!
|
||||
$language: String!
|
||||
$publisherId: Int
|
||||
$redeemCode: String
|
||||
) {
|
||||
createUser(
|
||||
email: $email
|
||||
@ -52,6 +53,7 @@ export const createUser = gql`
|
||||
lastName: $lastName
|
||||
language: $language
|
||||
publisherId: $publisherId
|
||||
redeemCode: $redeemCode
|
||||
) {
|
||||
id
|
||||
}
|
||||
|
||||
@ -140,6 +140,7 @@ export const elopageWebhook = async (req: any, res: any): Promise<void> => {
|
||||
firstName,
|
||||
lastName,
|
||||
publisherId: loginElopageBuy.publisherId || 0, // This seemed to be the default value if not set
|
||||
redeemCode: '',
|
||||
})
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
||||
@ -45,6 +45,7 @@ export const createUser = gql`
|
||||
$email: String!
|
||||
$language: String!
|
||||
$publisherId: Int
|
||||
$redeemCode: String
|
||||
) {
|
||||
createUser(
|
||||
email: $email
|
||||
@ -52,6 +53,7 @@ export const createUser = gql`
|
||||
lastName: $lastName
|
||||
language: $language
|
||||
publisherId: $publisherId
|
||||
redeemCode: $redeemCode
|
||||
) {
|
||||
id
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user