diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index 43934c1a5..832595b30 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -113,16 +113,20 @@ export class UserService { const verifyCode = uuidv4(); let sendVerificationMail: boolean; + const decryptClientId = await this.commonService.decryptPassword(clientId); + const decryptClientSecret = await this.commonService.decryptPassword(clientSecret); + try { - const token = await this.clientRegistrationService.getManagementToken(clientId, clientSecret); - const getClientData = await this.clientRegistrationService.getClientRedirectUrl(clientId, token); + const token = await this.clientRegistrationService.getManagementToken(decryptClientId, decryptClientSecret); + const getClientData = await this.clientRegistrationService.getClientRedirectUrl(decryptClientId, token); + const [redirectUrl] = getClientData[0]?.redirectUris || []; if (!redirectUrl) { throw new NotFoundException(ResponseMessages.user.error.redirectUrlNotFound); } - sendVerificationMail = await this.sendEmailForVerification(email, verifyCode, redirectUrl, clientId, brandLogoUrl, platformName); + sendVerificationMail = await this.sendEmailForVerification(email, verifyCode, redirectUrl, decryptClientId, brandLogoUrl, platformName); } catch (error) { throw new InternalServerErrorException(ResponseMessages.user.error.emailSend); } @@ -130,6 +134,8 @@ export class UserService { if (sendVerificationMail) { const uniqueUsername = await this.createUsername(email, verifyCode); userEmailVerification.username = uniqueUsername; + userEmailVerification.clientId = decryptClientId; + userEmailVerification.clientSecret = decryptClientSecret; const resUser = await this.userRepository.createUser(userEmailVerification, verifyCode); return resUser; } diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 44cc512b4..f26edb774 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -549,4 +549,5 @@ export const ResponseMessages = { walletRecordNotFound: 'Wallet record not found.' } } -}; \ No newline at end of file +}; + diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index f11ad5679..2d6dc1487 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -483,7 +483,7 @@ model file_upload { organisation organisation? @relation(fields: [orgId], references: [id]) orgId String? @db.Uuid credential_type String? - templateId String? @db.VarChar + templateId String? @db.VarChar } model file_data {