Permalink
Browse files

site wide copy updates

  • Loading branch information...
1 parent 165a788 commit 5a28b8f50b8d24474cd0df14b7a5daf02aab37d7 @lloyd lloyd committed Jun 30, 2012
Showing with 386 additions and 262 deletions.
  1. +2 −1 .gitignore
  2. +1 −0 config/aws.json
  3. +9 −0 lib/browserid/email_templates/add.ejs
  4. +9 −0 lib/browserid/email_templates/new.ejs
  5. +9 −0 lib/browserid/email_templates/reset.ejs
  6. +0 −10 lib/browserid/prove_template.ejs
  7. +58 −14 lib/email.js
  8. +53 −6 resources/static/common/css/style.css
  9. +5 −2 resources/static/common/js/user.js
  10. +3 −3 resources/static/common/js/wait-messages.js
  11. +1 −5 resources/static/dialog/css/m.css
  12. +22 −12 resources/static/dialog/css/style.css
  13. +21 −4 resources/static/dialog/js/misc/state.js
  14. +3 −5 resources/static/dialog/js/modules/actions.js
  15. +10 −2 resources/static/dialog/js/modules/authenticate.js
  16. +6 −3 resources/static/dialog/js/modules/check_registration.js
  17. +1 −1 resources/static/dialog/js/modules/pick_email.js
  18. +12 −14 resources/static/dialog/js/modules/provision_primary_user.js
  19. +4 −1 resources/static/dialog/js/modules/set_password.js
  20. +4 −2 resources/static/dialog/js/modules/verify_primary_user.js
  21. +7 −9 resources/static/dialog/views/add_email.ejs
  22. +29 −33 resources/static/dialog/views/authenticate.ejs
  23. +3 −12 resources/static/dialog/views/confirm_email.ejs
  24. +7 −6 resources/static/dialog/views/is_this_your_computer.ejs
  25. +12 −10 resources/static/dialog/views/pick_email.ejs
  26. +1 −1 resources/static/dialog/views/required_email.ejs
  27. +38 −26 resources/static/dialog/views/set_password.ejs
  28. +26 −68 resources/static/dialog/views/verify_primary_user.ejs
  29. +1 −0 resources/static/test/cases/common/js/user.js
  30. +11 −8 resources/views/dialog.ejs
  31. +1 −1 resources/views/dialog_layout.ejs
  32. +1 −1 resources/views/forgot.ejs
  33. +2 −1 resources/views/signin.ejs
  34. +1 −1 resources/views/signup.ejs
  35. +13 −0 scripts/awsbox/post_deploy.js
View
@@ -7,4 +7,5 @@
/npm-debug.log
/resources/static/build
/resources/static/production
-.DS_Store
+.DS_Store
+/locale
View
@@ -12,6 +12,7 @@
"supported_languages": [
"en-US", "it-CH", "db-LB"
],
+ "debug_lang": "it-CH",
"locale_directory": "/home/app/code/locale",
"var_path": "/home/app/var",
@@ -0,0 +1,9 @@
+<%= gettext('Thank you for using Persona.') %>
+
+<%= format(gettext('Click to confirm this email address and automatically sign in to %s'), [site]) %>
+<%= link %>
+
+<%= format(gettext('Note: If you are NOT trying to sign into this website, please ignore this email.'), [site]) %>
+
+<%= gettext('Thank you,') %>
+<%= gettext('The Persona team') %>
@@ -0,0 +1,9 @@
+<%= gettext('Thank you for using Persona.') %>
+
+<%= format(gettext('Click to confirm this email address and automatically sign in to %s'), [site]) %>
+<%= link %>
+
+<%= format(gettext('Note: If you are NOT trying to sign into this website, please ignore this email.'), [site]) %>
+
+<%= gettext('Thank you,') %>
+<%= gettext('The Persona team') %>
@@ -0,0 +1,9 @@
+<%= gettext('Forgot your password for Persona? It happens to the best of us.') %>
+
+<%= gettext('Click to reset your password:') %>
+<%= link %>
+
+<%= gettext('Note: If you did NOT ask to reset your password, please ignore this email.') %>
+
+<%= gettext('Thank you,') %>
+<%= gettext('The Persona team') %>
@@ -1,10 +0,0 @@
-<%= format(
- gettext('Thanks for verifying your email address. This message is being sent to you to complete your sign-in to %s.'), [site]) %>
-
-<%= gettext('Finish registration by clicking this link:') %> <%= link %>
-
-<%= gettext('If you are NOT trying to sign into this site, just ignore this email.') %>
-
-<%= gettext('Thanks,') %>
-<%= gettext('Persona') %>
-<%= gettext('(A better way to sign in)') %>
View
@@ -8,7 +8,8 @@ fs = require('fs'),
path = require('path'),
ejs = require('ejs'),
config = require('./configuration.js'),
-logger = require('./logging.js').logger;
+logger = require('./logging.js').logger,
+url = require('url');
/* if smtp parameters are configured, use them */
try { var smtp_params = config.get('smtp'); } catch(e) {};
@@ -27,8 +28,35 @@ if (smtp_params && smtp_params.host) {
}
}
-const template = ejs.compile(
- fs.readFileSync(path.join(__dirname, "browserid", "prove_template.ejs")).toString());
+const TEMPLATE_PATH = path.join(__dirname, "browserid", "email_templates");
+
+// the underbar decorator to allow getext to extract strings
+function _(str) { return str; }
+
+// a map of all the different emails we send
+const templates = {
+ "new": {
+ landing: 'verify_email_address',
+ subject: _("Confirm email address for Persona"),
+ template: fs.readFileSync(path.join(TEMPLATE_PATH, 'new.ejs')),
+ },
+ "reset": {
+ landing: 'verify_email_address',
+ subject: _("Reset Persona password"),
+ template: fs.readFileSync(path.join(TEMPLATE_PATH, 'reset.ejs')),
+ },
+ "add": {
+ landing: 'add_email_address',
+ subject: _("Confirm email address for Persona"),
+ template: fs.readFileSync(path.join(TEMPLATE_PATH, 'add.ejs')),
+ }
+};
+
+// now turn file contents into compiled templates
+Object.keys(templates).forEach(function(type) {
+ templates[type].template = ejs.compile(templates[type].template.toString());
+});
+
var interceptor = undefined;
@@ -48,24 +76,36 @@ exports.setInterceptor = function(callback) {
};
//TODO send in localeContext
-function doSend(landing_page, email, site, secret, langContext) {
- var url = config.get('public_url') + "/" + landing_page + "?token=" + encodeURIComponent(secret),
- _ = langContext.gettext,
+function doSend(email_type, email, site, secret, langContext) {
+ if (!templates[email_type]) throw "unknown email type: " + email_type;
+
+ // remove scheme from site to make it more human
+ site = url.parse(site).hostname;
+
+ var email_params = templates[email_type];
+
+ var public_url = config.get('public_url') + "/" + email_params.landing + "?token=" + encodeURIComponent(secret),
+ GETTEXT = langContext.gettext,
format = langContext.format;
if (interceptor) {
interceptor(email, site, secret);
} else if (config.get('email_to_console')) {
// log verification email to console separated by whitespace.
- console.log("\nVERIFICATION URL:\n" + url + "\n");
+ console.log("\nVERIFICATION URL:\n" + public_url + "\n");
} else {
- // TODO(aok) extract_po.sh isn't seeing this string if it's below in object literal
- var subject = format(_("Complete Login to %s using Persona"), [site]);
emailer.send_mail({
- sender: "Persona@persona.org",
+ // XXX: Ideally this would be a live email address and a response to these email
+ // addresses would go into a ticketing system (lloyd/skinny)
+ sender: "Persona <no-reply@persona.org>",
to: email,
- subject: subject,
- body: template({ link: url, site: site, gettext: _, format: format })
+ subject: GETTEXT(email_params.subject),
+ body: email_params.template({
+ link: public_url,
+ site: site,
+ gettext: GETTEXT,
+ format: format
+ })
}, function(err, success){
if (!success) {
logger.error("error sending email to: " + email + " - " + err);
@@ -75,9 +115,13 @@ function doSend(landing_page, email, site, secret, langContext) {
};
exports.sendNewUserEmail = function(email, site, secret, langContext) {
- doSend('verify_email_address', email, site, secret, langContext);
+ doSend('new', email, site, secret, langContext);
};
exports.sendAddAddressEmail = function(email, site, secret, langContext) {
- doSend('add_email_address', email, site, secret, langContext);
+ doSend('add', email, site, secret, langContext);
+};
+
+exports.sendForgotPasswordEmail = function(email, site, secret, langContext) {
+ doSend('reset', email, site, secret, langContext);
};
@@ -56,8 +56,13 @@ ul, li {
list-style-type: none;
}
-.mono {
- font-family: 'Monaco', monospace;
+strong {
+ font-weight: 700;
+}
+
+.hidden {
+ visibility: hidden;
+ height: 0;
}
.tooltip {
@@ -134,6 +139,18 @@ input[type=password]:disabled {
border-color: #b2b2b2;
}
+label + input[type=text],
+label + input[type=password],
+label + input[type=email] {
+ margin-top: 8px;
+}
+
+label.hidden + input[type=text],
+label.hidden + input[type=password],
+label.hidden + input[type=email] {
+ margin-top: 0;
+}
+
input[type=radio],
input[type=checkbox] {
cursor: pointer;
@@ -282,11 +299,30 @@ button.negative:active,
box-shadow: 0 0 5px #333 inset;
}
+.tospp {
+ line-height: 14px;
+}
+
+.buttonrow {
+ line-height: 28px;
+}
+
+.buttonrow > .right {
+ margin-right: 15px;
+}
+
+.buttonrow > .right.emphasize {
+ margin-right: 0;
+ margin-top: 8px;
+}
+
+/*
.submit #cancel {
float: right;
margin-right: 15px;
line-height: 28px;
}
+*/
a.secondary[disabled], .submit_disabled a.secondary, .submit_disabled a.secondary:focus, .submit_disabled a.secondary:active {
color: #999;
@@ -377,22 +413,34 @@ footer .help {
background-image: url("/common/i/grain.png"), linear-gradient(top, #dadee1, #c7ccd0);
}
+ /*
#wait, #delay {
text-align: center;
}
+*/
+#wait .contents, #error .contents, #delay .contents {
+ max-width: 430px;
+ margin: 0 auto;
+}
+#wait h2, #delay h2 {
+ font-size: 20px;
+}
-#wait h2, #error h2, #delay h2 {
+#error h2 {
font-size: 22px;
- margin-bottom: 10px;
+}
+
+#wait p, #error p, #delay p {
+ margin-top: 20px;
}
#error .emphasis {
margin-top: 15px;
color: #aa1401;
}
-#error_contents {
+#error .contents, #wait .contents {
max-width: 430px;
margin: 0 auto;
}
@@ -417,7 +465,6 @@ footer .help {
.submit {
margin-top: 10px;
- line-height: 14px;
}
.submit > p {
@@ -160,6 +160,10 @@ BrowserID.User = (function() {
throw "invalid email type (should be 'secondary' or 'primary'): " + type;
}
+ function getIdPName(addressInfo) {
+ return addressInfo.email.replace(/.*@/, "");
+ }
+
/**
* Persist an address and key pair locally.
* @method persistEmailKeypair
@@ -825,6 +829,7 @@ BrowserID.User = (function() {
if(info.type === "primary") {
User.isUserAuthenticatedToPrimary(email, info, function(authed) {
info.authed = authed;
+ info.idpName = getIdPName(info);
complete(info);
}, onFailure);
}
@@ -1224,8 +1229,6 @@ BrowserID.User = (function() {
} else {
complete(onFailure, "user is not authenticated");
}
-
- return shouldAsk;
}
};
@@ -7,7 +7,7 @@ BrowserID.Wait = (function(){
var Wait = {
authentication: {
title: gettext("Finishing Sign In..."),
- message: gettext("In just a moment you'll be signed into BrowserID.")
+ message: gettext("In just a moment you'll be signed into Persona.")
},
generateKey: {
@@ -16,8 +16,8 @@ BrowserID.Wait = (function(){
},
slowXHR: {
- title: gettext("We are sorry, this request is taking a LOOONG time."),
- message: gettext("This message will go away when the request completes (hopefully soon). If you wait too long, close this window and try again."),
+ title: gettext("We are sorry, this is taking a longer than it should."),
+ message: gettext("If this doesn't resolve itself within a few seconds, please close the window and try again."),
id: "slowXHR"
}
@@ -124,7 +124,7 @@
#selectEmail > .inputs > li > label {
margin: 0;
- padding: 15px 0;
+ padding: 8px 0;
}
#signIn .submit > p {
@@ -185,10 +185,6 @@
}
- .forgot {
- font-size: 16px;
- }
-
.inputs > li {
margin-top: 12px;
}
Oops, something went wrong.

0 comments on commit 5a28b8f

Please sign in to comment.