Merge remote-tracking branch 'upstream/develop' into feat/speedcheck-body
This commit is contained in:
commit
22928e5b5a
29 files changed
+897
-375
No files matched your search
@@ -13,6 +13,9 @@ const { handleErrors } = require("./middleware/handleErrors");
|
||||
const queueRouter = require("./routes/queueRoute");
|
||||
const JobQueue = require("./service/jobQueue");
|
||||
const pageSpeedCheckRouter = require("./routes/pageSpeedCheckRoute");
|
||||
const nodemailer = require("nodemailer");
|
||||
|
||||
const emailService = require("./service/emailService");
|
||||
|
||||
// Need to wrap server setup in a function to handle async nature of JobQueue
|
||||
const startApp = async () => {
|
||||
@@ -87,6 +90,41 @@ const startApp = async () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Nodemailer code here
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: process.env.EMAIL_SERVICE_HOST,
|
||||
port: process.env.EMAIL_SERVICE_PORT,
|
||||
auth: {
|
||||
user: process.env.EMAIL_SERVICE_USERNAME,
|
||||
pass: process.env.EMAIL_SERVICE_PASSWORD,
|
||||
},
|
||||
});
|
||||
|
||||
app.use("/api/v1/mail", (req, res) => {
|
||||
console.log("Started");
|
||||
// Replacing varibales
|
||||
const context = { name: "Alex" };
|
||||
|
||||
// Define mail options
|
||||
const mailOptions = {
|
||||
from: "BlueWave Uptime <bluewaveuptime@gmail.com>", // sender address
|
||||
to: "muhammadkhalilzadeh1998@gmailc.com", // list of receivers
|
||||
subject: "Testing template emails", // Subject line
|
||||
html: emailService.sendWelcomeEmail(context), // html body
|
||||
};
|
||||
|
||||
// Send mail with defined transport object
|
||||
transporter.sendMail(mailOptions, (error, info) => {
|
||||
if (error) {
|
||||
return res
|
||||
.status(500)
|
||||
.send({ message: "Error sending email", error: error });
|
||||
}
|
||||
console.log(info);
|
||||
res.status(200).send({ message: "Email sent successfully", info: info });
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Error handler middleware
|
||||
* Should be called last
|
||||
|
||||
Generated
+60
@@ -16,6 +16,7 @@
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"helmet": "^7.1.0",
|
||||
"joi": "^17.13.1",
|
||||
"jsonwebtoken": "9.0.2",
|
||||
@@ -23,6 +24,7 @@
|
||||
"mjml": "^1.3.4",
|
||||
"mongoose": "^8.3.3",
|
||||
"multer": "1.4.5-lts.1",
|
||||
"nodemailer": "^6.9.14",
|
||||
"ping": "0.4.4",
|
||||
"sharp": "0.33.4",
|
||||
"winston": "^3.13.0"
|
||||
@@ -2405,6 +2407,51 @@
|
||||
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
|
||||
"integrity": "sha512-8tLu60LgxF6XpdbK8OW3FA+IfTNBn1ZHGHKF4KQbEeSkajYw5PlYJcKluntgegDPTg8UkHjpet1T82vk6TQ68w=="
|
||||
},
|
||||
"node_modules/handlebars": {
|
||||
"version": "4.7.8",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
|
||||
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5",
|
||||
"neo-async": "^2.6.2",
|
||||
"source-map": "^0.6.1",
|
||||
"wordwrap": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"handlebars": "bin/handlebars"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.7"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"uglify-js": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/handlebars/node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/handlebars/node_modules/uglify-js": {
|
||||
"version": "3.19.0",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.0.tgz",
|
||||
"integrity": "sha512-wNKHUY2hYYkf6oSFfhwwiHo4WCHzHmzcXsqXYTN9ja3iApYIFbb2U6ics9hBcYLHcYGQoAlwnZlTrf3oF+BL/Q==",
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"uglifyjs": "bin/uglifyjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/handlebars/node_modules/wordwrap": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q=="
|
||||
},
|
||||
"node_modules/har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
@@ -3703,6 +3750,11 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/neo-async": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
||||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="
|
||||
},
|
||||
"node_modules/node-abort-controller": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz",
|
||||
@@ -3765,6 +3817,14 @@
|
||||
"node-gyp-build-optional-packages-test": "build-test.js"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.9.14",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.14.tgz",
|
||||
"integrity": "sha512-Dobp/ebDKBvz91sbtRKhcznLThrKxKt97GI2FAlAyy+fk19j73Uz3sBXolVtmcXjaorivqsbbbjDY+Jkt4/bQA==",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemon": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz",
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"helmet": "^7.1.0",
|
||||
"joi": "^17.13.1",
|
||||
"jsonwebtoken": "9.0.2",
|
||||
@@ -25,6 +26,7 @@
|
||||
"mjml": "^1.3.4",
|
||||
"mongoose": "^8.3.3",
|
||||
"multer": "1.4.5-lts.1",
|
||||
"nodemailer": "^6.9.14",
|
||||
"ping": "0.4.4",
|
||||
"sharp": "0.33.4",
|
||||
"winston": "^3.13.0"
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { compile } = require("handlebars");
|
||||
const { mjml2html } = require("mjml");
|
||||
|
||||
// Fetching Templates
|
||||
|
||||
// Welcome Email Template
|
||||
const welcomeEmailTemplatePath = path.join(
|
||||
__dirname,
|
||||
"../templates/welcomeEmail.mjml"
|
||||
);
|
||||
const welcomeEmailTemplateContent = fs.readFileSync(
|
||||
welcomeEmailTemplatePath,
|
||||
"utf8"
|
||||
);
|
||||
const welcomeEmailTemplate = compile(welcomeEmailTemplateContent);
|
||||
|
||||
// Employee Activation Email Template
|
||||
const employeeActivationTemplatePath = path.join(
|
||||
__dirname,
|
||||
"../templates/employeeActivation.mjml"
|
||||
);
|
||||
const employeeActivationTemplateContent = fs.readFileSync(
|
||||
employeeActivationTemplatePath,
|
||||
"utf8"
|
||||
);
|
||||
const employeeActivation = compile(employeeActivationTemplateContent);
|
||||
|
||||
// No Incident This Week Template
|
||||
const noIncidentsThisWeekTemplatePath = path.join(
|
||||
__dirname,
|
||||
"../templates/noIncidentsThisWeek.mjml"
|
||||
);
|
||||
const noIncidentsThisWeekTemplateContent = fs.readFileSync(
|
||||
noIncidentsThisWeekTemplatePath,
|
||||
"utf8"
|
||||
);
|
||||
const noIncidentsThisWeek = compile(noIncidentsThisWeekTemplateContent);
|
||||
|
||||
// Server is Down Template
|
||||
const serverIsDownTemplatePath = path.join(
|
||||
__dirname,
|
||||
"../templates/serverIsDown.mjml"
|
||||
);
|
||||
const serverIsDownTemplateContent = fs.readFileSync(
|
||||
serverIsDownTemplatePath,
|
||||
"utf8"
|
||||
);
|
||||
const serverIsDown = compile(serverIsDownTemplateContent);
|
||||
|
||||
// Server is Up Template
|
||||
const serverIsUpTemplatePath = path.join(
|
||||
__dirname,
|
||||
"../templates/serverIsUp.mjml"
|
||||
);
|
||||
const serverIsUpTemplateContent = fs.readFileSync(
|
||||
serverIsUpTemplatePath,
|
||||
"utf8"
|
||||
);
|
||||
const serverIsUp = compile(serverIsUpTemplateContent);
|
||||
|
||||
// Password Reset Template
|
||||
const passwordResetTemplatePath = path.join(
|
||||
__dirname,
|
||||
"../templates/passwordReset.mjml"
|
||||
);
|
||||
const passwordResetTemplateContent = fs.readFileSync(
|
||||
passwordResetTemplatePath,
|
||||
"utf8"
|
||||
);
|
||||
const passwordReset = compile(passwordResetTemplateContent);
|
||||
|
||||
// *** Application specific functions ***
|
||||
|
||||
function sendWelcomeEmail(context) {
|
||||
const mjml = welcomeEmailTemplate(context);
|
||||
const html = mjml2html(mjml);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function sendEmployeeActivationEmail(context) {
|
||||
const mjml = employeeActivation(context);
|
||||
const html = mjml2html(mjml);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function sendNoIncidentsThisWeekEmail(context) {
|
||||
const mjml = noIncidentsThisWeek(context);
|
||||
const html = mjml2html(mjml);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function sendServerIsDownEmail(context) {
|
||||
const mjml = serverIsDown(context);
|
||||
const html = mjml2html(mjml);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function sendServerIsUpEmail(context) {
|
||||
const mjml = serverIsUp(context);
|
||||
const html = mjml2html(mjml);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function sendPasswordResetEmail(context) {
|
||||
const mjml = passwordReset(context);
|
||||
const html = mjml2html(mjml);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sendWelcomeEmail,
|
||||
sendEmployeeActivationEmail,
|
||||
sendNoIncidentsThisWeekEmail,
|
||||
sendServerIsDownEmail,
|
||||
sendServerIsUpEmail,
|
||||
sendPasswordResetEmail,
|
||||
};
|
||||
@@ -16,10 +16,10 @@
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello Alex!</p>
|
||||
<p>Hello {{name}}!</p>
|
||||
<p>One of the admins created an account for you on the BlueWave Uptime server.</p>
|
||||
<p>You can go ahead and create your account using this link.</p>
|
||||
<p><a href="https://example.com">https://example.com</a></p>
|
||||
<p><a href={{link}}>{{link}}</a></p>
|
||||
<p>Thank you.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
@@ -31,4 +31,4 @@
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
</mjml>
|
||||
@@ -20,7 +20,7 @@
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello Alex!</p>
|
||||
<p>Hello {{name}}!</p>
|
||||
<p>There were no incidents this week. Good job!</p>
|
||||
<p><b>Current monitors:</b></p>
|
||||
<p><b>Google:</b> 100% availability</p>
|
||||
@@ -35,4 +35,4 @@
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
</mjml>
|
||||
@@ -1,51 +1,43 @@
|
||||
<mjml>
|
||||
<mj-head>
|
||||
<mj-font
|
||||
name="Roboto"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,500"
|
||||
></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text
|
||||
font-weight="300"
|
||||
font-size="16px"
|
||||
color="#616161"
|
||||
line-height="24px"
|
||||
></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello Alex!</p>
|
||||
<p>
|
||||
You are receiving this email because a password reset request
|
||||
has been made for gorkem.cetin@bluewavelabs.ca. Please use the
|
||||
code below on the site to reset your password.
|
||||
</p>
|
||||
<p>
|
||||
Verification Code: <b>4CCDFC45</b>
|
||||
</p>
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<mj-head>
|
||||
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Roboto:300,500"></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text font-weight="300" font-size="16px" color="#616161" line-height="24px"></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello {{name}}!</p>
|
||||
<p>
|
||||
You are receiving this email because a password reset request
|
||||
has been made for gorkem.cetin@bluewavelabs.ca. Please use the
|
||||
code below on the site to reset your password.
|
||||
</p>
|
||||
<p>
|
||||
Verification Code: <b>{{verificationCode}}</b>
|
||||
</p>
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
|
||||
<p>Thank you.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
<p>Thank you.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
@@ -1,71 +1,57 @@
|
||||
<mjml>
|
||||
<mj-head>
|
||||
<mj-font
|
||||
name="Roboto"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,500"
|
||||
></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text
|
||||
font-weight="300"
|
||||
font-size="16px"
|
||||
color="#616161"
|
||||
line-height="24px"
|
||||
></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="45%" padding-top="20px">
|
||||
<mj-text
|
||||
align="center"
|
||||
font-weight="500"
|
||||
padding="0px"
|
||||
font-size="18px"
|
||||
color="red"
|
||||
>
|
||||
Google.com is down
|
||||
</mj-text>
|
||||
<mj-divider border-width="2px" border-color="#616161"></mj-divider>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello Alex!</p>
|
||||
<p>
|
||||
We detected an incident on one of your monitors. Your service is
|
||||
currently down. We'll send a message to you once it is up again.
|
||||
</p>
|
||||
<p>
|
||||
<b>Monitor name:</b> Google.com
|
||||
</p>
|
||||
<p>
|
||||
<b>URL:</b> https://google.com
|
||||
</p>
|
||||
<p>
|
||||
<b>Problem:</b> Connection timeout
|
||||
</p>
|
||||
<p>
|
||||
<b>Start date:</b> Jun 8, 2024 8:15pm
|
||||
</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-button background-color="#1570EF">
|
||||
View incident details
|
||||
</mj-button>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
<mj-head>
|
||||
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Roboto:300,500"></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text font-weight="300" font-size="16px" color="#616161" line-height="24px"></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="45%" padding-top="20px">
|
||||
<mj-text align="center" font-weight="500" padding="0px" font-size="18px" color="red">
|
||||
Google.com is down
|
||||
</mj-text>
|
||||
<mj-divider border-width="2px" border-color="#616161"></mj-divider>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello {{name}}!</p>
|
||||
<p>
|
||||
We detected an incident on one of your monitors. Your service is
|
||||
currently down. We'll send a message to you once it is up again.
|
||||
</p>
|
||||
<p>
|
||||
<b>Monitor name:</b> {{monitor}}
|
||||
</p>
|
||||
<p>
|
||||
<b>URL:</b> {{url}}
|
||||
</p>
|
||||
<p>
|
||||
<b>Problem:</b> {{problem}}
|
||||
</p>
|
||||
<p>
|
||||
<b>Start date:</b> {{startDate}}
|
||||
</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-button background-color="#1570EF">
|
||||
View incident details
|
||||
</mj-button>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
@@ -1,77 +1,63 @@
|
||||
<mjml>
|
||||
<mj-head>
|
||||
<mj-font
|
||||
name="Roboto"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,500"
|
||||
></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text
|
||||
font-weight="300"
|
||||
font-size="16px"
|
||||
color="#616161"
|
||||
line-height="24px"
|
||||
></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="45%" padding-top="20px">
|
||||
<mj-text
|
||||
align="center"
|
||||
font-weight="500"
|
||||
padding="0px"
|
||||
font-size="18px"
|
||||
color="green"
|
||||
>
|
||||
Google.com is up
|
||||
</mj-text>
|
||||
<mj-divider border-width="2px" border-color="#616161"></mj-divider>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello Alex!</p>
|
||||
<p>
|
||||
Your latest incident is resolved and your monitored service is
|
||||
up again.
|
||||
</p>
|
||||
<p>
|
||||
<b>Monitor name:</b> Google.com
|
||||
</p>
|
||||
<p>
|
||||
<b>URL:</b> https://google.com
|
||||
</p>
|
||||
<p>
|
||||
<b>Problem:</b> Connection timeout
|
||||
</p>
|
||||
<p>
|
||||
<b>Start date:</b> Jun 8, 2024 8:15pm
|
||||
</p>
|
||||
<p>
|
||||
<b>Resolved date:</b> Jun 8, 2024 8:15pm
|
||||
</p>
|
||||
<p>
|
||||
<b>Duration:</b>3 minutes and 15 seconds
|
||||
</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-button background-color="#1570EF">
|
||||
View incident details
|
||||
</mj-button>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
<mj-head>
|
||||
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Roboto:300,500"></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text font-weight="300" font-size="16px" color="#616161" line-height="24px"></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="45%" padding-top="20px">
|
||||
<mj-text align="center" font-weight="500" padding="0px" font-size="18px" color="green">
|
||||
{{monitor}} is up
|
||||
</mj-text>
|
||||
<mj-divider border-width="2px" border-color="#616161"></mj-divider>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello {{name}}!</p>
|
||||
<p>
|
||||
Your latest incident is resolved and your monitored service is
|
||||
up again.
|
||||
</p>
|
||||
<p>
|
||||
<b>Monitor name:</b> {{monitor}}
|
||||
</p>
|
||||
<p>
|
||||
<b>URL:</b> {{url}}
|
||||
</p>
|
||||
<p>
|
||||
<b>Problem:</b> {{problem}}
|
||||
</p>
|
||||
<p>
|
||||
<b>Start date:</b> {{startDate}}
|
||||
</p>
|
||||
<p>
|
||||
<b>Resolved date:</b> {{resolvedDate}}
|
||||
</p>
|
||||
<p>
|
||||
<b>Duration:</b>{{duration}}
|
||||
</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-button background-color="#1570EF">
|
||||
View incident details
|
||||
</mj-button>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
@@ -1,51 +1,43 @@
|
||||
<mjml>
|
||||
<mj-head>
|
||||
<mj-font
|
||||
name="Roboto"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,500"
|
||||
></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text
|
||||
font-weight="300"
|
||||
font-size="16px"
|
||||
color="#616161"
|
||||
line-height="24px"
|
||||
></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello Alex!</p>
|
||||
<p>
|
||||
Thank you for trying out BlueWave Uptime! We developed it with
|
||||
great care to meet our own needs, and we're excited to share it
|
||||
with you.
|
||||
</p>
|
||||
<p>
|
||||
BlueWave Uptime is an automated way of checking whether a
|
||||
service such as a website or an application is available or not.
|
||||
</p>
|
||||
<p>We hope you find our service as valuable as we do.</p>
|
||||
<p>Thank you.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
<mj-head>
|
||||
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Roboto:300,500"></mj-font>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Roboto, Helvetica, sans-serif"></mj-all>
|
||||
<mj-text font-weight="300" font-size="16px" color="#616161" line-height="24px"></mj-text>
|
||||
<mj-section padding="0px"></mj-section>
|
||||
</mj-attributes>
|
||||
</mj-head>
|
||||
<mj-body>
|
||||
<mj-section padding="20px 0">
|
||||
<mj-column width="100%">
|
||||
<mj-text align="left" font-size="10px">
|
||||
Message from BlueWave Uptime Service
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
<mj-section>
|
||||
<mj-column width="100%">
|
||||
<mj-text>
|
||||
<p>Hello {{name}}!</p>
|
||||
<p>
|
||||
Thank you for trying out BlueWave Uptime! We developed it with
|
||||
great care to meet our own needs, and we're excited to share it
|
||||
with you.
|
||||
</p>
|
||||
<p>
|
||||
BlueWave Uptime is an automated way of checking whether a
|
||||
service such as a website or an application is available or not.
|
||||
</p>
|
||||
<p>We hope you find our service as valuable as we do.</p>
|
||||
<p>Thank you.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column width="100%">
|
||||
<mj-divider border-width="1px" border-color="#E0E0E0"></mj-divider>
|
||||
<mj-text font-size="12px">
|
||||
<p>This email was sent by BlueWave Uptime.</p>
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
</mj-body>
|
||||
</mjml>
|
||||
@@ -6,14 +6,32 @@ const joi = require("joi");
|
||||
|
||||
const loginValidation = joi.object({
|
||||
email: joi.string().email().required(),
|
||||
password: joi.string().min(8).required(),
|
||||
password: joi
|
||||
.string()
|
||||
.min(8)
|
||||
.required()
|
||||
.pattern(
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()])[A-Za-z0-9!@#$%^&*()]+$/
|
||||
),
|
||||
});
|
||||
|
||||
const registerValidation = joi.object({
|
||||
firstname: joi.string().required(),
|
||||
lastname: joi.string().required(),
|
||||
firstname: joi
|
||||
.string()
|
||||
.required()
|
||||
.pattern(/^[A-Za-z]+$/),
|
||||
lastname: joi
|
||||
.string()
|
||||
.required()
|
||||
.pattern(/^[A-Za-z]+$/),
|
||||
email: joi.string().email().required(),
|
||||
password: joi.string().min(8).required(),
|
||||
password: joi
|
||||
.string()
|
||||
.min(8)
|
||||
.required()
|
||||
.pattern(
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()])[A-Za-z0-9!@#$%^&*()]+$/
|
||||
),
|
||||
profileImage: joi.any(),
|
||||
role: joi.string().required(),
|
||||
});
|
||||
@@ -23,11 +41,21 @@ const editUserParamValidation = joi.object({
|
||||
});
|
||||
|
||||
const editUserBodyValidation = joi.object({
|
||||
firstname: joi.string(),
|
||||
lastname: joi.string(),
|
||||
firstname: joi.string().pattern(/^[A-Za-z]+$/),
|
||||
lastname: joi.string().pattern(/^[A-Za-z]+$/),
|
||||
profileImage: joi.any(),
|
||||
newPassword: joi.string().min(8),
|
||||
password: joi.string().min(8),
|
||||
newPassword: joi
|
||||
.string()
|
||||
.min(8)
|
||||
.pattern(
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()])[A-Za-z0-9!@#$%^&*()]+$/
|
||||
),
|
||||
password: joi
|
||||
.string()
|
||||
.min(8)
|
||||
.pattern(
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()])[A-Za-z0-9!@#$%^&*()]+$/
|
||||
),
|
||||
deleteProfileImage: joi.boolean(),
|
||||
role: joi.string(),
|
||||
});
|
||||
@@ -45,7 +73,13 @@ const recoveryTokenValidation = joi.object({
|
||||
|
||||
const newPasswordValidation = joi.object({
|
||||
recoveryToken: joi.string().required(),
|
||||
password: joi.string().min(8).required(),
|
||||
password: joi
|
||||
.string()
|
||||
.min(8)
|
||||
.required()
|
||||
.pattern(
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()])[A-Za-z0-9!@#$%^&*()]+$/
|
||||
),
|
||||
confirm: joi.string(),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user