diff --git a/browserid/lib/email.js b/browserid/lib/email.js index 3bf5ba231b90b85b6132d8f0ef9c4a11b19ab645..bc5fa584cdc0aaccdbd26c0f4c29b540e52415c5 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 d2dcc44ea0291e25d760be7dd9bd6f8916a9fb33..09a7d7c8e4acb7987d05ab014098d57025535f10 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 17748617206b56b06457b8d6f01104188d49d075..bcf2119ecb1ace2d9c6282afdf633b6693981509 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 6ad6d4a5fb0ee59d206b16f61d61a93738f41a20..fa979371ef0beea8062c4555c8226ed085f9b03b 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);