Added emails, changes to CSS, more login logic
parent
016c6a6cdd
commit
74d97ee2c3
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const nodemailer = require('nodemailer');
|
||||
const nodemailer = require('nodemailer'),
|
||||
env = require('./env.js');
|
||||
|
||||
let transporter = nodemailer.createTransport({
|
||||
host: 'keithirwin.us',
|
||||
|
@ -11,30 +12,45 @@ let transporter = nodemailer.createTransport({
|
|||
user: 'NoReply@tracman.org',
|
||||
pass: 'Ei0UwfrZuE'
|
||||
},
|
||||
logger: true,
|
||||
debug: true
|
||||
// logger: true,
|
||||
// debug: true
|
||||
});
|
||||
|
||||
/* Confirm login */
|
||||
// transporter.verify(function(err, success) {
|
||||
// if (err){ console.error(`SMTP Error: ${err}`); }
|
||||
// if (success){
|
||||
// console.log("SMTP ready...");
|
||||
// } else {
|
||||
// console.error("SMTP not ready!");
|
||||
// }
|
||||
// console.log(`SMTP ${!success?'not ':''}ready...`);
|
||||
// });
|
||||
|
||||
/* Send test email */
|
||||
transporter.sendMail({
|
||||
to: `"Keith Irwin" <mail@keithirwin.us>`,
|
||||
from: '"Tracman" <NoReply@tracman.org>',
|
||||
subject: 'Test email',
|
||||
text: "Looks like everything's working",
|
||||
}).then(function(){
|
||||
console.log("Email should have sent...");
|
||||
}).catch(function(err){
|
||||
console.error(err);
|
||||
});
|
||||
// transporter.sendMail({
|
||||
// to: `"Keith Irwin" <hypergeek14@gmail.com>`,
|
||||
// from: '"Tracman" <NoReply@tracman.org>',
|
||||
// subject: 'Test email',
|
||||
// text: "Looks like everything's working",
|
||||
// html: ""
|
||||
// }).then(function(){
|
||||
// console.log("Email should have sent...");
|
||||
// }).catch(function(err){
|
||||
// console.error(err);
|
||||
// });
|
||||
|
||||
module.exports = transporter.sendMail.bind(transporter);
|
||||
module.exports = {
|
||||
|
||||
send: transporter.sendMail.bind(transporter),
|
||||
|
||||
text: function(text) {
|
||||
return `Tracman\n\n${text}\n\nDo not reply to this email\nFor information about why you received this email, see the privacy policy at ${env.url}/privacyy#email`;
|
||||
},
|
||||
|
||||
html: function(text) {
|
||||
return `<h1><a href="/" style="text-decoration:none;"><span style="color:#000;font-family:sans-serif;font-size:36px;font-weight:bold"><img src="${env.url}/static/img/icon/by/32.png" alt="+" style="margin-right:10px">Tracman</span></a></h1>${text}<p style="font-size:8px;">Do not reply to this email. For information about why you recieved this email, see our <a href="${env.url}/privacy#email">privacy policy</a>. </p>`;
|
||||
},
|
||||
|
||||
from: `"Tracman" <NoReply@tracman.org>`,
|
||||
|
||||
to: function(user) {
|
||||
return `"${user.name}" <${user.email}>`;
|
||||
}
|
||||
|
||||
};
|
|
@ -6,8 +6,7 @@ module.exports = {
|
|||
|
||||
// Throw error
|
||||
throwErr: function(req,err){
|
||||
console.error('middleware.js:5 '+typeof err);
|
||||
console.error('Middleware error:'+err+'\nfor request:\n'+req);
|
||||
console.error('Middleware error:'+err.message+'\nfor request:\n'+req);
|
||||
if (env.mode==='production') {
|
||||
req.flash('danger', 'An error occured. <br>Would you like to <a href="https://github.com/Tracman-org/Server/issues/new">report it</a>?');
|
||||
} else { // development
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
const router = require('express').Router(),
|
||||
mw = require('../middleware.js'),
|
||||
User = require('../models.js').user;
|
||||
User = require('../models.js').user,
|
||||
mail = require('../mail.js');
|
||||
|
||||
router.route('/')
|
||||
.all(mw.ensureAdmin, function(req,res,next){
|
||||
|
@ -47,7 +48,23 @@ router.route('/users')
|
|||
else { req.flash('success', '<i>'+user.name+'</i> deleted.'); }
|
||||
res.redirect('/admin#users');
|
||||
});
|
||||
} else { console.log('ERROR! POST without action sent. '); next(); }
|
||||
} else { console.error('ERROR! POST without action sent. '); next(); }
|
||||
});
|
||||
|
||||
router.route('/testmail').get(function(req,res,next){
|
||||
mail.send({
|
||||
to: `"Keith Irwin" <hypergeek14@gmail.com>`,
|
||||
from: mail.from,
|
||||
subject: 'Test email',
|
||||
text: mail.text("Looks like everything's working! "),
|
||||
html: mail.html("<p>Looks like everything's working! </p>")
|
||||
}).then(function(){
|
||||
console.log("Test email should have sent...");
|
||||
res.sendStatus(200);
|
||||
}).catch(function(err){
|
||||
mw.throwErr(err);
|
||||
next();
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -36,7 +36,7 @@ h1, h2, h3 {
|
|||
position: relative;
|
||||
z-index: 6;
|
||||
}
|
||||
h1,h2,h3,h4 { font-weight: 600; }
|
||||
h1, h2, h3, h4 { font-weight: 600; }
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
line-height: 46px; }
|
||||
|
@ -58,12 +58,10 @@ main a:hover:not(.btn) {
|
|||
color: #fbc93d;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.light a:not(.btn) {
|
||||
color:#111;
|
||||
a.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.light a:hover {
|
||||
color:#111;
|
||||
a.underline:hover:not(.btn) {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
<p>In lieu of legalease, which I don't speak, here is a quick rundown of what Tracman does with your data (such as location). </p>
|
||||
|
||||
<h3>Location history</h3>
|
||||
<h3 id='location-history'>Location history</h3>
|
||||
|
||||
<p>Your location is saved on the database as long as you have it "set" or "tracking". If you "clear" the data, it will be deleted from the database too. This doesn't mean all copies are destroyed. Our servers keep occasional backups, and caches could exist on other servers (google index, wayback archive, etc). </p>
|
||||
|
||||
<p>This means that all public access to your location is essentially deleted when you clear it. But anyone could record your location while it's publicly available and rebroadcast it. Tracman doesn't store location histories (except as mentioned above), but histories may exist elsewhere! If you have (or plan to have) trouble with the law, don't use Tracman. Authorities have easy access to those histories. </p>
|
||||
|
||||
<h3>Email addresses</h3>
|
||||
<h3 id='email'>Email addresses</h3>
|
||||
|
||||
<p>Tracman stores email addresses so we can contact users for important stuff (urgent security updates, deletion requests, lost passwords). We will never subscribe you to anything else by default. </p>
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
<h2>Account settings</h2>
|
||||
|
||||
<div id='name' class='form-group' title="This appears in your page's title. ">
|
||||
<label for="name">Name</label>
|
||||
<input class='form-control' name="name" type="text" value="{{user.name}}" maxlength="160">
|
||||
</div>
|
||||
<label for="name">Name</label>
|
||||
<input class='form-control' name="name" type="text" value="{{user.name}}" maxlength="160">
|
||||
</div>
|
||||
|
||||
<div id='email' class='form-group' title="For account stuff, no dumb newsletters. ">
|
||||
<label for="email">Email</label>
|
||||
|
@ -35,7 +35,6 @@
|
|||
#social-connect > .btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
margin-left: 1vw;
|
||||
margin-right: 1vw;
|
||||
flex-grow: 1;
|
||||
|
@ -98,8 +97,8 @@
|
|||
</div>
|
||||
|
||||
<div id='password-delete' class='form-group'>
|
||||
<a href="/settings/password?next=/settings" title="Click here to {% if user.auth.password %}change{% else %}set{% endif %} your password. ">{% if user.auth.password %}Change{% else %}Set{% endif %} password</a>
|
||||
<a class='red' style="text-align:right" href="#" onclick="deleteAccount()" title="Permently delete your Tracman account. ">Delete account</a>
|
||||
<a class='underline' href="/settings/password?next=/settings" title="Click here to {% if user.auth.password %}change{% else %}set{% endif %} your password. ">{% if user.auth.password %}Change{% else %}Set{% endif %} password</a>
|
||||
<a class='red underline' style="text-align:right" href="#" onclick="deleteAccount()" title="Permently delete your Tracman account. ">Delete account</a>
|
||||
</div>
|
||||
|
||||
<h2>Map settings</h2>
|
||||
|
|
Loading…
Reference in New Issue