Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MONGO_URI=mongodb://localhost:27017/nodeapi
PORT=8080
JWT_SECRET=xxxxxx
CLIENT_URL=http://localhost:3000
RESET_PASSWORD=://[enter_public_ip_for_production]
REACT_APP_GOOGLE_CLIENT_ID=xxxxxx.apps.googleusercontent.com
```

Expand Down
6 changes: 4 additions & 2 deletions controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ exports.forgotPassword = (req, res) => {
const token = jwt.sign({ _id: user._id, iss: process.env.APP_NAME }, process.env.JWT_SECRET);

// email data
// Change RESET_PASSWORD to CLIENT_URL if you are in a Development Environment, as
// RESET_PASSWORD is only used in production environments
const emailData = {
from: 'noreply@node-react.com',
to: email,
subject: 'Password Reset Instructions',
text: `Please use the following link to reset your password: ${
process.env.CLIENT_URL
process.env.RESET_PASSWORD
}/reset-password/${token}`,
html: `<p>Please use the following link to reset your password:</p> <p>${
process.env.CLIENT_URL
process.env.RESET_PASSWORD
}/reset-password/${token}</p>`
};

Expand Down