From 7b22a743c5e13e47ad964ee71c34dc7120019535 Mon Sep 17 00:00:00 2001 From: shishirbychapur Date: Mon, 23 Sep 2024 12:20:01 +0800 Subject: [PATCH] fix: resolve pr comments --- backend/user-service/package.json | 3 ++- backend/user-service/src/controllers/auth.controller.ts | 6 +++--- backend/user-service/src/routes/auth.routes.ts | 4 ++-- backend/user-service/src/routes/user.routes.ts | 2 +- package-lock.json | 6 +++++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/backend/user-service/package.json b/backend/user-service/package.json index 38457783d8..7ac876947c 100644 --- a/backend/user-service/package.json +++ b/backend/user-service/package.json @@ -13,7 +13,6 @@ "license": "MIT", "description": "", "dependencies": { - "@types/nodemailer": "^6.4.16", "bcrypt": "^5.1.1", "class-validator": "^0.14.1", "cors": "^2.8.5", @@ -37,6 +36,8 @@ "@types/helmet": "^0.0.48", "@types/jest": "^29.5.13", "@types/jsonwebtoken": "^9.0.7", + "@types/node": "^22.5.5", + "@types/nodemailer": "^6.4.16", "@types/passport": "^1.0.16", "@types/passport-local": "^1.0.38", "@types/supertest": "^6.0.2", diff --git a/backend/user-service/src/controllers/auth.controller.ts b/backend/user-service/src/controllers/auth.controller.ts index 294595ee10..e9abc72c27 100644 --- a/backend/user-service/src/controllers/auth.controller.ts +++ b/backend/user-service/src/controllers/auth.controller.ts @@ -88,12 +88,12 @@ export async function sendMail(to: string, subject: string, text: string, html: port: 587, secure: false, auth: { - user: process.env.EMAIL, - pass: process.env.PASSWORD, + user: process.env.NODEMAILER_EMAIL, + pass: process.env.NODEMAILER_PASSWORD, }, }) await transporter.sendMail({ - from: process.env.EMAIL, + from: process.env.NODEMAILER_EMAIL, to, subject, text, diff --git a/backend/user-service/src/routes/auth.routes.ts b/backend/user-service/src/routes/auth.routes.ts index fdf179ab53..bb117dcbe7 100644 --- a/backend/user-service/src/routes/auth.routes.ts +++ b/backend/user-service/src/routes/auth.routes.ts @@ -20,7 +20,7 @@ passport.use( const router = Router() router.post('/login', passport.authenticate('local', { session: false }), handleLogin) -router.put('/reset', handleReset) -router.put('/verify', handleVerify) +router.post('/reset', handleReset) +router.post('/verify', handleVerify) export default router diff --git a/backend/user-service/src/routes/user.routes.ts b/backend/user-service/src/routes/user.routes.ts index ff83799729..61e4ff50db 100644 --- a/backend/user-service/src/routes/user.routes.ts +++ b/backend/user-service/src/routes/user.routes.ts @@ -14,6 +14,6 @@ router.post('/', handleCreateUser) router.put('/:id', handleUpdateProfile) router.get('/:id', handleGetCurrentProfile) router.delete('/:id', handleDeleteUser) -router.put('/password/:id', handleUpdatePassword) +router.put('/:id/password', handleUpdatePassword) export default router diff --git a/package-lock.json b/package-lock.json index b74c799ebb..1f8a244497 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,6 @@ "version": "0.1.0", "license": "MIT", "dependencies": { - "@types/nodemailer": "^6.4.16", "bcrypt": "^5.1.1", "class-validator": "^0.14.1", "cors": "^2.8.5", @@ -100,6 +99,8 @@ "@types/helmet": "^0.0.48", "@types/jest": "^29.5.13", "@types/jsonwebtoken": "^9.0.7", + "@types/node": "^22.5.5", + "@types/nodemailer": "^6.4.16", "@types/passport": "^1.0.16", "@types/passport-local": "^1.0.38", "@types/supertest": "^6.0.2", @@ -3270,6 +3271,7 @@ "version": "22.5.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", + "devOptional": true, "dependencies": { "undici-types": "~6.19.2" } @@ -3278,6 +3280,7 @@ "version": "6.4.16", "resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.4.16.tgz", "integrity": "sha512-uz6hN6Pp0upXMcilM61CoKyjT7sskBoOWpptkjjJp8jIMlTdc3xG01U7proKkXzruMS4hS0zqtHNkNPFB20rKQ==", + "dev": true, "dependencies": { "@types/node": "*" } @@ -12428,6 +12431,7 @@ }, "node_modules/undici-types": { "version": "6.19.8", + "devOptional": true, "license": "MIT" }, "node_modules/universalify": {