diff --git a/README.md b/README.md index 98d2494fd62f5589067359c087001f459fde5300..86a4a8dc648773476cfa6fbba5d67f8e6a7b15c1 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ All of the servers here are based on node.js, and some number of 3rd party node * sqlite (>= 1.0.3) * mustache (>= 0.3.1) * cookie-sessions (>= 0.0.2) +* nodemailer (>= 0.1.18) ## Getting started: diff --git a/authority/server/email.js b/authority/server/email.js index 0266c9bce512baf7af28ab8f3f50d4c647620eb8..59a01aa96b3f4a1179742a5df9bbfb72dfc6a75d 100644 --- a/authority/server/email.js +++ b/authority/server/email.js @@ -1,6 +1,20 @@ -const db = require('./db'); +const db = require('./db'), + emailer = require('nodemailer'), + fs = require('fs'), + path = require('path'), +mustache = require('mustache'); + +const template = fs.readFileSync(path.join(__dirname, "prove_template.txt")).toString(); exports.sendVerificationEmail = function(email, secret) { var url = "https://browserid.org/prove.html?token=" + secret; - console.log("sending a verification email with url: " + url); + + emailer.send_mail({ + sender: "noreply@browserid.org", + to: email, + subject : "BrowserID: confirm email address - " + email, + body: mustache.to_html(template, { email: email, link: url }) + }, function(err, success){ + if(!success) console.log("error sending email: ", err); + }); }; diff --git a/authority/server/prove_template.txt b/authority/server/prove_template.txt new file mode 100644 index 0000000000000000000000000000000000000000..92424a3afa9fd9be237b16319feab3655f4be445 --- /dev/null +++ b/authority/server/prove_template.txt @@ -0,0 +1,13 @@ +Hello {{email}}, + +This message is being sent to you because someone is trying to log +into a site using this email address. If you are presently logging +into a website using BrowserID, then click the link below to complete +your login: + +{{link}} + +If you are NOT trying to log into a website, just delete this email. + +Sincerely, +BrowserID (A better way to login) diff --git a/authority/static/dialog/index.html b/authority/static/dialog/index.html index 50e36b5da675be97acf381244ba4fd56d5a8d36f..c0fb00329c7f0c28994849cef251b50631cb7e25 100644 --- a/authority/static/dialog/index.html +++ b/authority/static/dialog/index.html @@ -53,7 +53,7 @@ <div class="content"> <div class="summary">Welcome, <span class="email good"></span>. You will receive a <strong>confirmation email</strong> in a few moments. To activate your BrowserID, please <strong>visit the link</strong> included in the email.</div> <div class="attention"> - Waiting for email confirmation... <span class="bad"> THIS ISN'T REAL! JUST WAIT 5 SECONDS!</span> + Waiting for email confirmation... </div> <div class="actions"> <div class="action"> No email yet? <a href="#">Resend it!</a></div>