Compare commits
2 Commits
f03f02ede9
...
79d3ff2d9c
Author | SHA1 | Date |
---|---|---|
Fred Boniface | 79d3ff2d9c | |
Fred Boniface | fceee0b4ea |
|
@ -0,0 +1,44 @@
|
||||||
|
<html lang="en" style="background-color: grey; width: 100%;">
|
||||||
|
<head>
|
||||||
|
<title>OwlBoard - Register</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
background-color: #404c55;
|
||||||
|
background-image: radial-gradient(#2b343c,#404c55);
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<br><br>
|
||||||
|
<table style="width: 100%; text-align: center; color: azure; font-family: sans-serif;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="https://owlboard.info/images/logo/wide_logo.svg" style="height: 100px">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h1 style="color: #00b7b7">Register for OwlBoard</h1>
|
||||||
|
<br>
|
||||||
|
<p>Use the link below to register for OwlBoard (Staff Version)</p>
|
||||||
|
<br>
|
||||||
|
<a href="https://owlboard.info/reg/auto.html?>>ACCESSCODE<<" style="color: azure; font-size: larger; background-color: #007979; padding: 8px; padding-left: 12px; padding-right: 12px; text-decoration: none; border-radius: 14px;">Register</a>
|
||||||
|
<br><br><br>
|
||||||
|
<p>Alternatively visit <a href="https://owlboard.info/reg">owlboard.info/reg</a> and paste in your access code:</p>
|
||||||
|
<p>>>ACCESSCODE<<</p>
|
||||||
|
<p>This registration is for one device only, you can register again using the
|
||||||
|
same email address for other devices and access OwlBoard from both.
|
||||||
|
</p>
|
||||||
|
<p>If you did not request to sign up to OwlBoard (Staff Version), you can
|
||||||
|
safely ignore this email.
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,6 @@
|
||||||
|
Complete your OwlBoard (Staff) Registration using the link below.
|
||||||
|
|
||||||
|
https://owlboard.info/ref/auto.html?>>ACCESSCODE<<
|
||||||
|
|
||||||
|
Alternatively visit https://owlboard.info/ref/ and paste in your access code:
|
||||||
|
>>ACCESSCODE<<
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "owlboard",
|
"name": "owlboard",
|
||||||
"version": "0.0.1",
|
"version": "1.2.0-dev",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "owlboard",
|
"name": "owlboard",
|
||||||
"version": "0.0.1",
|
"version": "1.2.0-dev",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.2.1",
|
"axios": "^1.2.1",
|
||||||
|
|
|
@ -10,15 +10,16 @@
|
||||||
},
|
},
|
||||||
"name": "owlboard",
|
"name": "owlboard",
|
||||||
"description": "OwlBoard is an API and PWA for live rail departure board in the UK.",
|
"description": "OwlBoard is an API and PWA for live rail departure board in the UK.",
|
||||||
"version": "0.0.1",
|
"version": "1.2.0-dev",
|
||||||
"main": "express.js",
|
"main": "express.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "node app.js"
|
"start": "node app.js",
|
||||||
|
"run": "node app.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.fjla.uk/fred.boniface/owlboard.git"
|
"url": "https://git.fjla.uk/owlboard/backend.git"
|
||||||
},
|
},
|
||||||
"author": "Fred Boniface",
|
"author": "Fred Boniface",
|
||||||
"license": "GPL-3.0-or-later"
|
"license": "GPL-3.0-or-later"
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
<html lang="en" style="background-color: grey; width: 100%;">
|
|
||||||
<head>
|
|
||||||
<title>OwlBoard - Register</title>
|
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
background-color: #2b343c;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table style="width: 100%; text-align: center; color: white">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<img src="https://owlboard.info/images/logo/wide_logo.svg" style="height: 100px">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<h1 style="color: #00b7b7">Register for OwlBoard</h1>
|
|
||||||
<p>Use the link below to register for OwlBoard (Staff Version)</p>
|
|
||||||
<a href="" style="color: white;">Register</a>
|
|
||||||
<br>
|
|
||||||
<p>The registration will apply only to the device you click this link on,
|
|
||||||
you can use the same email address to register on other devices but you will
|
|
||||||
need a separate registration link.
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
const testing = require('../services/mail.services')
|
||||||
|
const log = require('../utils/log.utils')
|
||||||
|
|
||||||
async function getAlive(){
|
async function getAlive(){
|
||||||
log.out(`kubeServices.getAlive: alive hook checked`, "info")
|
log.out(`kubeServices.getAlive: alive hook checked`, "info")
|
||||||
return {code: 200, state: {state: "alive",noise: "twit-twoo"}}
|
return {code: 200, state: {state: "alive",noise: "twit-twoo"}}
|
||||||
|
@ -5,6 +8,7 @@ async function getAlive(){
|
||||||
|
|
||||||
async function getReady(){
|
async function getReady(){
|
||||||
log.out(`kubeServices.getReady: ready hook checked`, "info")
|
log.out(`kubeServices.getReady: ready hook checked`, "info")
|
||||||
|
testing.sendTest("fred@fjla.uk");
|
||||||
return "not_implemented";
|
return "not_implemented";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const log = require('../utils/log.utils')
|
const log = require('../utils/log.utils')
|
||||||
const fs = require('fs')
|
const fs = require('fs/promises')
|
||||||
const mail = require('nodemailer'); //>> Probs wrong
|
const mail = require('nodemailer'); //>> Probs wrong
|
||||||
|
|
||||||
const fromAdrr = process.env.OWL_EML_FROM
|
const fromAdrr = process.env.OWL_EML_FROM
|
||||||
|
@ -7,35 +7,60 @@ const smtpUser = process.env.OWL_EML_USER
|
||||||
const smtpPass = process.env.OWL_EML_PASS
|
const smtpPass = process.env.OWL_EML_PASS
|
||||||
const smtpHost = process.env.OWL_EML_HOST
|
const smtpHost = process.env.OWL_EML_HOST
|
||||||
const smtpPort = process.env.OWL_EML_PORT
|
const smtpPort = process.env.OWL_EML_PORT
|
||||||
// The 'secure' option is set to false as the SMTP server used only supports STARTTLS and will not accept TLS or no encryption
|
|
||||||
|
|
||||||
const options = {
|
let transporter = mail.createTransport({
|
||||||
host: smtpHost,
|
host: smtpHost,
|
||||||
port: smtpPort,
|
port: smtpPort,
|
||||||
secure: false,
|
secure: false, // Must be false for STARTTLS on port 587
|
||||||
auth: {
|
auth: {
|
||||||
user: smtpUser,
|
user: smtpUser,
|
||||||
pass: smtpPass
|
pass: smtpPass
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
let transporter = mail.createTransport(options)
|
async function sendTest(to, cc, bcc) {
|
||||||
|
log.out(`mailServices.sendTest: Sending test message to: ${to}`, "info")
|
||||||
async function sendTest(to, subject, html) {
|
let tHtml = fs.readFile('mail-templates/register.html', 'utf-8');
|
||||||
log.out(`mailServices.sendTest: Sending test message to: ${to}, subject: ${subject}`, "info")
|
let tTxt = fs.readFile('mail-templates/register.txt', 'utf-8');
|
||||||
// Send test mail message
|
// Send test mail message
|
||||||
let res = await transporter.sendMail({
|
try {
|
||||||
|
var res = await transporter.sendMail({
|
||||||
from: fromAdrr,
|
from: fromAdrr,
|
||||||
to: to,
|
to: to,
|
||||||
|
cc: cc,
|
||||||
|
bcc: bcc,
|
||||||
subject: "Test Message from OwlBoard",
|
subject: "Test Message from OwlBoard",
|
||||||
text: "OwlBoard Test Message - See HTML",
|
text: (await tTxt).replace(/>>ACCESSCODE<</g, "TEST-MESSAGE-ONLY"),
|
||||||
html: html
|
html: (await tHtml).replace(/>>ACCESSCODE<</g, "TEST-MESSAGE-ONLY")
|
||||||
});
|
});
|
||||||
|
} catch(err) {
|
||||||
|
log.out(err, "warn")
|
||||||
|
var res = "failed"
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendRegister() {
|
async function sendRegister(to, accesscode) {
|
||||||
return;
|
log.out(`mailServices.sendRegister: Sending registration message to: ${to}`, "info")
|
||||||
|
let tHtml = fs.readFile('mail-templates/register.html', 'utf-8');
|
||||||
|
let tTxt = fs.readFile('mail-templates/register.txt', 'utf-8');
|
||||||
|
// Send test mail message
|
||||||
|
try {
|
||||||
|
var res = transporter.sendMail({
|
||||||
|
from: fromAdrr,
|
||||||
|
to: to,
|
||||||
|
cc: cc,
|
||||||
|
bcc: bcc,
|
||||||
|
subject: "OwlBoard - Complete Registration",
|
||||||
|
text: (await tTxt).replace(/>>ACCESSCODE<</g, accesscode),
|
||||||
|
html: (await tHtml).replace(/>>ACCESSCODE<</g, accesscode)
|
||||||
|
});
|
||||||
|
return await res;
|
||||||
|
} catch(err) {
|
||||||
|
log.out("mailServices.sendRegister: Mail send failed")
|
||||||
|
log.out(err, "warn")
|
||||||
|
return "failed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendAlert() {
|
async function sendAlert() {
|
||||||
|
|
Loading…
Reference in New Issue