diff --git a/mailer.js b/mailer.js index 5799bd2..570fa8a 100644 --- a/mailer.js +++ b/mailer.js @@ -1,11 +1,35 @@ import nodemailer from "nodemailer"; +// Create a transporter using SMTP const transporter = nodemailer.createTransport({ - host: "smtp.example.com", + host: "us1.smtp.bird.com", port: 587, secure: false, // use STARTTLS (upgrade connection to TLS after connecting) auth: { - user: process.env.SMTP_USER, - pass: process.env.SMTP_PASS, + user: "bird", + pass: "", // TODO: use environment variables }, }); + +try { + await transporter.verify(); + console.log("Server is ready to take our messages"); +} catch (err) { + console.error("Verification failed:", err); +} + +try { + const info = await transporter.sendMail({ + from: '"CPC Security" ', // sender address + to: "cpcplatteville@proton.me", // list of recipients + subject: "Hello", // subject line + text: "Hello world?", // plain text body + html: "Hello world?", // HTML body + }); + + console.log("Message sent: %s", info.messageId); + // Preview URL is only available when using an Ethereal test account + console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info)); +} catch (err) { + console.error("Error while sending mail:", err); +} diff --git a/package-lock.json b/package-lock.json index 965eb12..c1830ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@messagebird/sdk": "^0.134.0", "ejs": "^6.0.1", "express": "^5.2.1", "nodemailer": "^10.0.10", @@ -35,6 +36,21 @@ "kuler": "^2.0.0" } }, + "node_modules/@messagebird/sdk": { + "version": "0.134.0", + "resolved": "https://registry.npmjs.org/@messagebird/sdk/-/sdk-0.134.0.tgz", + "integrity": "sha512-9QG1zJDe6DLFo51D5uWMUpEitzOiDyAGqD/DHbghqdrh5EKkd6ySF6v/4mG7TqAQN5B+14DG27NSv2JjAXXG9A==", + "license": "MIT", + "dependencies": { + "standardwebhooks": "1.0.0" + }, + "engines": { + "node": ">=20.3.0" + }, + "optionalDependencies": { + "undici": "6.29.1" + } + }, "node_modules/@so-ric/colorspace": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/@so-ric/colorspace/-/colorspace-1.1.6.tgz", @@ -45,6 +61,12 @@ "text-hex": "1.0.x" } }, + "node_modules/@stablelib/base64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-1.0.1.tgz", + "integrity": "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==", + "license": "MIT" + }, "node_modules/@types/triple-beam": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", @@ -71,18 +93,18 @@ "license": "MIT" }, "node_modules/body-parser": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz", - "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", + "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", "license": "MIT", "dependencies": { "bytes": "^3.1.2", - "content-type": "^2.0.0", + "content-type": "^2.1.0", "debug": "^4.4.3", "http-errors": "^2.0.1", - "iconv-lite": "^0.7.2", + "iconv-lite": "^0.7.3", "on-finished": "^2.4.1", - "qs": "^6.15.2", + "qs": "^6.16.1", "raw-body": "^3.0.2", "type-is": "^2.1.0" }, @@ -392,6 +414,12 @@ "url": "https://opencollective.com/express" } }, + "node_modules/fast-sha256": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-sha256/-/fast-sha256-1.3.0.tgz", + "integrity": "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==", + "license": "Unlicense" + }, "node_modules/fecha": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", @@ -721,9 +749,9 @@ } }, "node_modules/nodemailer": { - "version": "10.0.10", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.10.tgz", - "integrity": "sha512-He9XskOFms62SyAKkLu8CcGcYHAo+BSHSsORI8s4PJH8qZgZY4L4lDfvyN0twvmbpyG+eGrxpyBlskj9d9rJ8A==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.5.0.tgz", + "integrity": "sha512-L/w/HH5MqpzMDuZD7fQdt/+KqymuvrpaApaIjAH2XA3ILePwlcvXCVVvP75xVrXCEt2ggK2marrrHHFB5Qu0kA==", "license": "MIT-0", "engines": { "node": ">=20.0.0" @@ -808,9 +836,9 @@ } }, "node_modules/qs": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", - "integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==", + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", "license": "BSD-3-Clause", "dependencies": { "es-define-property": "^1.0.1", @@ -1048,6 +1076,16 @@ "node": "*" } }, + "node_modules/standardwebhooks": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.0.0.tgz", + "integrity": "sha512-BbHGOQK9olHPMvQNHWul6MYlrRTAOKn03rOe4A8O3CLWhNf4YHBqq2HJKKC+sfqpxiBY52pNeesD6jIiLDz8jg==", + "license": "MIT", + "dependencies": { + "@stablelib/base64": "^1.0.0", + "fast-sha256": "^1.3.0" + } + }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -1121,6 +1159,16 @@ "url": "https://opencollective.com/express" } }, + "node_modules/undici": { + "version": "6.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz", + "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.17" + } + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/package.json b/package.json index c666aee..8588176 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { + "@messagebird/sdk": "^0.134.0", "ejs": "^6.0.1", "express": "^5.2.1", "nodemailer": "^10.0.10", diff --git a/ui/assets/sop/lock.png b/ui/assets/sop/lock.png new file mode 100644 index 0000000..194f7d1 Binary files /dev/null and b/ui/assets/sop/lock.png differ diff --git a/ui/partials/evalidate.ejs b/ui/partials/evalidate.ejs index de8b69b..1e18164 100644 --- a/ui/partials/evalidate.ejs +++ b/ui/partials/evalidate.ejs @@ -1 +1,56 @@ -

Hello World!

+
+
+ +
+ +

OTP Code Verification

+

Code expires in 5 minutes

+
+ + + +
+
+ + + + + + +
+
+ +
+
+ + diff --git a/ui/sop.ejs b/ui/sop.ejs index 3e9e37b..d98f62d 100644 --- a/ui/sop.ejs +++ b/ui/sop.ejs @@ -106,6 +106,8 @@