@@ -9,7 +9,8 @@ const Services = {
99 Email : require ( "../services/email.service" ) ,
1010 AccountConfirmation : require ( "../services/accountConfirmation.service" ) ,
1111 Role : require ( "../services/role.service" ) ,
12- RoleBinding : require ( "../services/roleBinding.service" )
12+ RoleBinding : require ( "../services/roleBinding.service" ) ,
13+ Env : require ( "../services/env.service" )
1314} ;
1415
1516const Middleware = {
@@ -140,7 +141,8 @@ async function sendResetPasswordEmailMiddleware(req, res, next) {
140141 const ResetPasswordTokenModel = await Services . ResetPasswordToken . findByAccountId ( user . id ) ;
141142 //generate email
142143 const token = Services . ResetPasswordToken . generateToken ( ResetPasswordTokenModel . id , user . id ) ;
143- const mailData = Services . ResetPasswordToken . generateResetPasswordEmail ( process . env . FRONTEND_ADDRESS , req . body . email , token ) ;
144+ const address = Services . Env . isProduction ( ) ? process . env . FRONTEND_ADDRESS_DEPLOY : process . env . FRONTEND_ADDRESS_DEV ;
145+ const mailData = Services . ResetPasswordToken . generateResetPasswordEmail ( address , req . body . email , token ) ;
144146 if ( mailData !== undefined ) {
145147 Services . Email . send ( mailData , ( err ) => {
146148 if ( err ) {
@@ -176,7 +178,8 @@ async function sendConfirmAccountEmailMiddleware(req, res, next) {
176178 await Services . AccountConfirmation . create ( Constants . General . HACKER , account . email , account . id ) ;
177179 const accountConfirmationToken = await Services . AccountConfirmation . findByAccountId ( account . id ) ;
178180 const token = Services . AccountConfirmation . generateToken ( accountConfirmationToken . id , account . id ) ;
179- const mailData = Services . AccountConfirmation . generateAccountConfirmationEmail ( process . env . FRONTEND_ADDRESS , account . email , Constants . General . HACKER , token ) ;
181+ const address = Services . Env . isProduction ( ) ? process . env . FRONTEND_ADDRESS_DEPLOY : process . env . FRONTEND_ADDRESS_DEV ;
182+ const mailData = Services . AccountConfirmation . generateAccountConfirmationEmail ( address , account . email , Constants . General . HACKER , token ) ;
180183 if ( mailData !== undefined ) {
181184 Services . Email . send ( mailData , ( err ) => {
182185 if ( err ) {
@@ -214,7 +217,8 @@ async function resendConfirmAccountEmail(req, res, next) {
214217 } ) ;
215218 }
216219 const token = Services . AccountConfirmation . generateToken ( accountConfirmationToken . id , account . id ) ;
217- const mailData = Services . AccountConfirmation . generateAccountConfirmationEmail ( process . env . FRONTEND_ADDRESS , account . email , accountConfirmationToken . accountType , token ) ;
220+ const address = Services . Env . isProduction ( ) ? process . env . FRONTEND_ADDRESS_DEPLOY : process . env . FRONTEND_ADDRESS_DEV ;
221+ const mailData = Services . AccountConfirmation . generateAccountConfirmationEmail ( address , account . email , accountConfirmationToken . accountType , token ) ;
218222 if ( mailData !== undefined ) {
219223 Services . Email . send ( mailData , ( err ) => {
220224 if ( err ) {
0 commit comments