From 65bd2b49087018609eeee3e7175f212c53862a24 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Tue, 21 Jun 2011 23:54:41 -0600 Subject: [PATCH] one more pass at improving verification emails, both for add_email and for account creation --- browserid/lib/email.js | 3 +-- browserid/lib/prove_template.txt | 13 +++++++------ browserid/lib/wsapi.js | 4 ++-- browserid/static/dialog/main.js | 6 ++++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/browserid/lib/email.js b/browserid/lib/email.js index 3bf5ba231..bc5fa584c 100644 --- a/browserid/lib/email.js +++ b/browserid/lib/email.js @@ -12,9 +12,8 @@ exports.sendVerificationEmail = function(email, site, secret) { emailer.send_mail({ sender: "noreply@browserid.org", to: email, - site: site, subject : "Complete Login to " + site + " using BrowserID", - body: mustache.to_html(template, { email: email, link: url }) + body: mustache.to_html(template, { email: email, link: url, site: site }) }, function(err, success){ if(!success) { console.log("error sending email: ", err); diff --git a/browserid/lib/prove_template.txt b/browserid/lib/prove_template.txt index d2dcc44ea..09a7d7c8e 100644 --- a/browserid/lib/prove_template.txt +++ b/browserid/lib/prove_template.txt @@ -1,11 +1,12 @@ -Hello {{email}}, +Hi {{email}}, -This message is being sent to you to complete your log in to -{{site}}. To complete your login, click the link below: +This message is being sent to you to complete your login to +{{site}}. Click the link below to continue: {{link}} -If you are NOT trying to log into {{site}}, please just delete this email. +If you are NOT trying to log into {{site}}, just ignore this email. -Sincerely, -BrowserID (A better way to login) +Thanks, +BrowserID +(A better way to login) diff --git a/browserid/lib/wsapi.js b/browserid/lib/wsapi.js index 177486172..bcf2119ec 100644 --- a/browserid/lib/wsapi.js +++ b/browserid/lib/wsapi.js @@ -126,7 +126,7 @@ exports.add_email = function (req, resp) { var urlobj = url.parse(req.url, true); var getArgs = urlobj.query; - if (!checkParams(getArgs, resp, [ "email", "pubkey" ])) return; + if (!checkParams(getArgs, resp, [ "email", "pubkey", "site" ])) return; if (!checkAuthed(req, resp)) return; @@ -143,7 +143,7 @@ exports.add_email = function (req, resp) { httputils.jsonResponse(resp, true); // let's now kick out a verification email! - email.sendVerificationEmail(getArgs.email, secret); + email.sendVerificationEmail(getArgs.email, getArgs.site, secret); } catch(e) { // we should differentiate tween' 400 and 500 here. httputils.badRequest(resp, e.toString()); diff --git a/browserid/static/dialog/main.js b/browserid/static/dialog/main.js index 6ad6d4a5f..fa979371e 100644 --- a/browserid/static/dialog/main.js +++ b/browserid/static/dialog/main.js @@ -419,7 +419,9 @@ ); $.ajax({ - url: '/wsapi/add_email?email=' + encodeURIComponent(email) + '&pubkey=' + encodeURIComponent(keypair.pub), + url: '/wsapi/add_email?email=' + encodeURIComponent(email) + + '&pubkey=' + encodeURIComponent(keypair.pub) + + '&site=' + encodeURIComponent(remoteOrigin.replace(/^(http|https):\/\//, '')), success: function() { // email successfully staged, now wait for email confirmation runConfirmEmailDialog(email, keypair, onsuccess, onerror); @@ -479,7 +481,7 @@ url: '/wsapi/stage_user?email=' + encodeURIComponent(email) + '&pass=' + encodeURIComponent(pass) + '&pubkey=' + encodeURIComponent(keypair.pub) - + '&site=' + encodeURIComponent(window.location.host), + + '&site=' + encodeURIComponent(remoteOrigin.replace(/^(http|https):\/\//, '')), success: function() { // account successfully staged, now wait for email confirmation runConfirmEmailDialog(email, keypair, onsuccess, onerror); -- GitLab