-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed emails templates and link from application validation expirat…
…ion time Co-authored-by: Daniel Ferreira <[email protected]>
- Loading branch information
1 parent
0bd0830
commit 441c78e
Showing
12 changed files
with
45 additions
and
52 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 |
---|---|---|
|
@@ -20,8 +20,8 @@ JWT_SECRET=Lendas contam que o Rui foi membro do IEEE. | |
# Frontend Password Recovery Base Route | ||
PASSWORD_RECOVERY_LINK=https://localhost:3000/recover | ||
|
||
# Froantend Application Confirmation Base Route | ||
APPLICATION_CONFIRMATION_LINK=https://localhost:8087/apply/company/validate/ | ||
# Frontend Application Confirmation Base Route | ||
APPLICATION_CONFIRMATION_LINK=https://localhost:3000/apply/company/validate/ | ||
|
||
# Specifies the port in which the app will be exposed | ||
PORT=8087 | ||
|
@@ -43,10 +43,10 @@ ACCESS_CONTROL_ALLOW_ORIGIN= | |
# Check this for details on how to configure your personal account for testing (https://support.google.com/accounts/answer/185833?p=InvalidSecondFactor&visit_id=637446218993181653-2339409452&rd=1) | ||
|
||
# The email address from which the emails are sent | ||
MAIL_FROM=[email protected] | ||
MAIL_FROM= | ||
|
||
# Password for email above | ||
MAIL_FROM_PASSWORD=PgAnnVsAa6Sg8zJp6t | ||
MAIL_FROM_PASSWORD= | ||
|
||
# Cloudinary API URL to save images | ||
CLOUDINARY_URL= | ||
|
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,17 +1,15 @@ | ||
import CompanyApplication, { CompanyApplicationRules } from "../../models/CompanyApplication.js"; | ||
import { APIError, ErrorTypes } from "./errorHandler.js"; | ||
import { StatusCodes as HTTPStatus } from "http-status-codes/build/cjs/status-codes.js"; | ||
export const exceededCreationTimeLimit = async (email) => { | ||
const cursor = await CompanyApplication.findOne({ email, isVerified: false }).exec(); | ||
if (cursor !== null && Date.now() - cursor.submittedAt < 5000 * 60) { | ||
throw new APIError(HTTPStatus.FORBIDDEN, ErrorTypes.FORBIDDEN, CompanyApplicationRules.APPLICATION_RECENTLY_CREATED); | ||
import { VALIDATION_LINK_EXPIRATION } from "../../models/constants/ApplicationStatus.js"; | ||
import { SECOND_IN_MS } from "../../models/constants/TimeConstants.js"; | ||
|
||
export const exceededCreationTimeLimit = async (req, res, next) => { | ||
const application = await CompanyApplication.findOne({ email:req.body.email, isVerified: false }); | ||
if (application !== null && Date.now() < application.submittedAt.getTime() + VALIDATION_LINK_EXPIRATION * SECOND_IN_MS) { | ||
return next( new APIError(HTTPStatus.FORBIDDEN, ErrorTypes.FORBIDDEN, CompanyApplicationRules.APPLICATION_RECENTLY_CREATED.msg)); | ||
} | ||
return true; | ||
return next(); | ||
}; | ||
|
||
export const deleteApplications = async (email) => { | ||
await CompanyApplication.deleteMany({ email: email, isVerified: false }).catch(function(error) { | ||
console.error(error); | ||
throw (error); // Failure | ||
}); | ||
}; | ||
|
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<h1>Confirm your NIJobs application</h1> | ||
<p>Please follow this <a href="{{link}}" target="_blank">link</a> to finish the process. Note that the link will be expired in 5 minutes.</p> | ||
<p>We have successfully received your application!</p> | ||
<p>Please follow this <a href="{{link}}" target="_blank">link</a> to finish the process. Note that the link will expire in 10 minutes.</p> | ||
<br> | ||
<p>If you did not request this or need anything else, please contact us at <a href="mailto:[email protected]">[email protected]</a>!</p><br> | ||
<p>Sincerely,</p> | ||
|
7 changes: 4 additions & 3 deletions
7
src/email-templates/new_company_application_company.handlebars
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,8 +1,9 @@ | ||
<h1>We have successfully received your application!</h1> | ||
<p>We will now review your application, and in case you're approved, you will receive another email with further instructions in order to complete your registration.</p> | ||
<h1>Your application has been validated!</h1> | ||
<p>We will now review your application, and in case you're approved, you will receive another email with further instructions in order to complete your registration.</p> | ||
<p>Your Application ID is {{applicationId}} and you registered {{companyName}}</p> | ||
<p>Once you're approved, you will receive an email, and then you can log into NIJobs! Do not forget your password, you will need it on the first login.</p> | ||
<br> | ||
<p>If you did not request this or if you need anything else, don't hesitate to contact us at <a href="mailto:[email protected]">[email protected]</a>!</p> | ||
<br> | ||
<p>Sincerely,</p> | ||
<p>NIJobs team at NIAEFEUP</p> | ||
<p>NIJobs team at NIAEFEUP</p> |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ export class EmailService { | |
|
||
async init({ email: user, password: pass }) { | ||
this.email = user; | ||
/* const transporter = await nodemailer.createTransport({ | ||
const transporter = await nodemailer.createTransport({ | ||
pool: true, | ||
host: "smtp.gmail.com", | ||
port: 465, | ||
|
@@ -17,15 +17,6 @@ export class EmailService { | |
}, | ||
connectionTimeout: 30000 | ||
}); | ||
console.log("transporter");*/ | ||
const transporter = nodemailer.createTransport({ | ||
host: "smtp.ethereal.email", | ||
port: 587, | ||
auth: { | ||
user: "[email protected]", | ||
pass: "NGEVbMnTZzyA3MQD3V" | ||
} | ||
}); | ||
|
||
transporter.use("compile", hbs({ | ||
viewEngine: { | ||
|
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