-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend ready for sending password reset link in mail
- Loading branch information
1 parent
72dd65c
commit 217b8c7
Showing
9 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const CART_ADD_ITEM = 'CART_ADD_ITEM' | ||
export const CART_REMOVE_ITEM = 'CART_REMOVE_ITEM' | ||
export const CART_RESET = 'CART_RESET' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import express from 'express' | ||
import { authUser, getUserProfile, registerUser, updateUserProfile } from '../controller/userController.js' | ||
import { authUser, forgetPassword, getUserProfile, registerUser, resetPassword, updateUserProfile } from '../controller/userController.js' | ||
import { isLoggedIn } from '../middlewares/authMiddleware.js' | ||
|
||
const router = express.Router() | ||
|
||
router.post("/login", authUser) | ||
router.post("/register",registerUser) | ||
router.route("/profile").get(isLoggedIn, getUserProfile).put(isLoggedIn, updateUserProfile) | ||
router.post("/forget-password", forgetPassword) | ||
router.put("/reset-password/:resetToken",resetPassword) | ||
|
||
|
||
|
||
export default router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import nodemailer from 'nodemailer' | ||
|
||
export const sendEmail = (options) => { | ||
let transporter = nodemailer.createTransport({ | ||
service: "gmail", | ||
auth: { | ||
user: process.env.EMAIL_NAME, | ||
pass: process.env.EMAIL_PASS | ||
|
||
}, | ||
}) | ||
|
||
const mailOptions = { | ||
from: process.env.EMAIL_NAME, | ||
to: options.to, | ||
subject: options.subject, | ||
html: options.text | ||
} | ||
|
||
transporter.sendMail(mailOptions, function (err, info) { | ||
if (err) { | ||
console.log(err); | ||
}else console.log(info); | ||
}) | ||
} | ||
|