|
1 | 1 | import crypto from 'crypto'; |
2 | 2 |
|
3 | 3 | import User from '../models/user'; |
4 | | -import mail from '../utils/mail'; |
| 4 | +import { mailerService } from '../utils/mail'; |
5 | 5 | import { renderEmailConfirmation, renderResetPassword } from '../views/mail'; |
6 | 6 |
|
7 | 7 | export * from './user.controller/apiKey'; |
@@ -83,7 +83,7 @@ export async function createUser(req, res) { |
83 | 83 | }); |
84 | 84 |
|
85 | 85 | try { |
86 | | - await mail.send(mailOptions); |
| 86 | + await mailerService.send(mailOptions); |
87 | 87 | res.json(userResponse(user)); |
88 | 88 | } catch (mailErr) { |
89 | 89 | console.error(mailErr); |
@@ -155,7 +155,7 @@ export async function resetPasswordInitiate(req, res) { |
155 | 155 | to: user.email |
156 | 156 | }); |
157 | 157 |
|
158 | | - await mail.send(mailOptions); |
| 158 | + await mailerService.send(mailOptions); |
159 | 159 | res.json({ |
160 | 160 | success: true, |
161 | 161 | message: |
@@ -203,7 +203,7 @@ export async function emailVerificationInitiate(req, res) { |
203 | 203 | to: user.email |
204 | 204 | }); |
205 | 205 | try { |
206 | | - await mail.send(mailOptions); |
| 206 | + await mailerService.send(mailOptions); |
207 | 207 | } catch (mailErr) { |
208 | 208 | res.status(500).send({ error: 'Error sending mail' }); |
209 | 209 | return; |
@@ -334,7 +334,7 @@ export async function updateSettings(req, res) { |
334 | 334 | to: user.email |
335 | 335 | }); |
336 | 336 |
|
337 | | - await mail.send(mailOptions); |
| 337 | + await mailerService.send(mailOptions); |
338 | 338 | } else { |
339 | 339 | await saveUser(res, user); |
340 | 340 | } |
|
0 commit comments