forked from simonlourson/blueprintnotincluded
-
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.
implement reset-password email link process
- Loading branch information
Showing
25 changed files
with
562 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
14 |
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 |
---|---|---|
|
@@ -54,3 +54,12 @@ EXPOSE 3000 | |
|
||
#RUN npm run dev | ||
ENTRYPOINT npm run dev | ||
|
||
ENV [email protected] | ||
ENV EMAIL_PASS=your-16-char-app-password | ||
ENV SITE_URL=http://localhost:3000 | ||
ENV SMTP_HOST=localhost | ||
ENV SMTP_PORT=25 | ||
ENV SMTP_USER= | ||
ENV SMTP_PASS= | ||
ENV [email protected] |
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import nodemailer from 'nodemailer'; | ||
|
||
const transporter = nodemailer.createTransport({ | ||
host: process.env.SMTP_HOST || 'localhost', | ||
port: parseInt(process.env.SMTP_PORT || '25'), | ||
secure: false, // true for 465, false for other ports | ||
auth: process.env.SMTP_USER ? { | ||
user: process.env.SMTP_USER, | ||
pass: process.env.SMTP_PASS | ||
} : undefined | ||
}); | ||
|
||
export async function sendResetEmail(email: string, token: string) { | ||
console.log('Attempting to send reset email to:', email); | ||
|
||
const mailOptions = { | ||
from: process.env.SMTP_FROM || '[email protected]', | ||
to: email, | ||
subject: 'Password Reset Request', | ||
text: `To reset your password, click this link: ${process.env.SITE_URL}/reset-password?token=${token}` | ||
}; | ||
|
||
try { | ||
const info = await transporter.sendMail(mailOptions); | ||
console.log('Reset email sent:', info.response); | ||
return info; | ||
} catch (error) { | ||
console.error('Error sending reset email:', error); | ||
throw error; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,10 +11,15 @@ services: | |
- JWT_SECRET=anylongstringhere | ||
- CAPTCHA_SITE=localhost | ||
- CAPTCHA_SECRET=YOURCAPTCHASECRET | ||
- SMTP_HOST=mailhog | ||
- SMTP_PORT=1025 | ||
- [email protected] | ||
links: | ||
- "mongodb-bpni:database" | ||
- "mailhog:mailhog" | ||
depends_on: | ||
- mongodb-bpni | ||
- mailhog | ||
ports: | ||
- "3000:3000" | ||
mongodb-bpni: | ||
|
@@ -25,4 +30,10 @@ services: | |
volumes: | ||
- ./mongo/docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro | ||
ports: | ||
- "27017:27017" | ||
- "27017:27017" | ||
mailhog: | ||
image: mailhog/mailhog | ||
container_name: mailhog-bpni | ||
ports: | ||
- "1025:1025" | ||
- "8025:8025" |
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 |
---|---|---|
|
@@ -2,6 +2,26 @@ | |
|
||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.8. | ||
|
||
## Environment Variables | ||
|
||
The following environment variables are required for the application to run: | ||
|
||
### Required | ||
- `DB_URI` - MongoDB connection string | ||
- `JWT_SECRET` - Secret key for JWT token generation | ||
- `SITE_URL` - Base URL of the site (e.g., http://localhost:3000) | ||
|
||
### Email Configuration (SMTP) | ||
- `SMTP_HOST` - SMTP server hostname (default: localhost) | ||
- `SMTP_PORT` - SMTP server port (default: 25) | ||
- `SMTP_USER` - SMTP username (optional) | ||
- `SMTP_PASS` - SMTP password (optional) | ||
- `SMTP_FROM` - From email address (default: [email protected]) | ||
|
||
### reCAPTCHA (Production Only) | ||
- `CAPTCHA_SITE` - Google reCAPTCHA site key | ||
- `CAPTCHA_SECRET` - Google reCAPTCHA secret key | ||
|
||
## Development server | ||
|
||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. | ||
|
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
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
Oops, something went wrong.