Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
integrating train 2011.10.20
Browse files Browse the repository at this point in the history
  • Loading branch information
lloyd committed Oct 27, 2011
2 parents 03e2ab0 + fe2a041 commit ab0307d
Show file tree
Hide file tree
Showing 38 changed files with 677 additions and 408 deletions.
18 changes: 18 additions & 0 deletions ChangeLog
@@ -1,3 +1,21 @@
train-2011.10.20:
* android < 3.0 now supported: #461
* properly set assertion expiration time to when they expire, not when they're issued: #433, #457, #458
* update privacy policy language to jive with new UI: #381
* add redirects for old URLs that no longer exist with the new UI: #376
* inside the minified include.js, link to uncompressed version for developer convenience and discovery: #432
* language tweaks: #437, #444
* improve button UI appearance on opera and IE: #435
* improve visual feedback for links: #440
* UI fixes for > 2 email addresses on iOS: #417
* smooth out screen transitions in dialog: #369
* improved "check your email" screen on mobile: #462
* no auto-caps nor auto-correct for iOS in add email field: #464
* improve event listening on input fields: #406
* remember email when moving user from signup to sign-in for known email address: #108
* don't call sync_emails more than necessary: #434
* assertions now include full origin (scheme+host+port). verifier accepts only host+port OR full origin, and returns whatever RP sends for back compat: #82

train-2011.10.13:
* fix verification of email in different browser than where verification is initiated: #336
* Android < 3.0 (browsers that can't handle JSON.parse("null")) now blocked explicitly (until we complete support)
Expand Down
20 changes: 20 additions & 0 deletions browserid/app.js
Expand Up @@ -137,6 +137,26 @@ function router(app) {
res.render('verifyemail.ejs', {title: 'Verify Email Address', fullpage: false});
});

// REDIRECTS
REDIRECTS = {
"/manage": "/",
"/users": "/",
"/users/": "/",
"/primaries" : "/developers",
"/primaries/" : "/developers",
"/developers" : "https://github.com/mozilla/browserid/wiki/How-to-Use-BrowserID-on-Your-Site"
};

// set up all the redirects
// oh my watch out for scope issues on var url - closure time
for (var url in REDIRECTS) {
(function(from,to) {
app.get(from, function(req, res) {
res.redirect(to);
});
})(url, REDIRECTS[url]);
}

// register all the WSAPI handlers
wsapi.setup(app);

Expand Down
2 changes: 1 addition & 1 deletion browserid/compress.sh
Expand Up @@ -20,7 +20,7 @@ echo ''

cd static
mv include.js include.orig.js
$UGLIFY -nc include.orig.js > include.js
$UGLIFY include.orig.js > include.js

echo ''
echo '****Building dialog HTML, CSS, and JS****'
Expand Down
1 change: 0 additions & 1 deletion browserid/lib/email.js
Expand Up @@ -44,7 +44,6 @@ logger = require('../../libs/logging.js').logger;

/* if smtp parameters are configured, use them */
var smtp_params = config.get('smtp');
console.log("SMTP", smtp_params);
if (smtp_params && smtp_params.host) {
emailer.SMTP = { host: smtp_params.host };
logger.info("delivering email via SMTP host: " + emailer.SMTP.host);
Expand Down
24 changes: 13 additions & 11 deletions browserid/static/css/style.css
Expand Up @@ -79,7 +79,7 @@ a {
text-decoration: none;
}

a:hover {
a:hover, button:hover, input[type=submit]:hover {
text-decoration: underline;
}

Expand Down Expand Up @@ -315,10 +315,6 @@ div.steps {
border-radius: 5px;
}

#manage .edit a:hover {
text-decoration: none;
}

#manageAccounts {
background-color: #37A6FF;
border: 1px solid #37A6FF;
Expand All @@ -330,7 +326,8 @@ div.steps {
-o-box-shadow: 0 0 0 1px #76C2FF inset;
box-shadow: 0 0 0 1px #76C2FF inset;

background-image: -moz-linear-gradient(center top , #76C2FF 0pt, #37A6FF 100%);
background-image: -moz-linear-gradient(#76C2FF 0pt, #37A6FF 100%);
background-image: -o-linear-gradient(#76C2FF 0pt, #37A6FF 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #76C2FF), color-stop(100%, #37A6FF));
}

Expand All @@ -346,7 +343,8 @@ div.steps {
-o-box-shadow: 0 0 5px #003763 inset;
box-shadow: 0 0 5px #003763 inset;

background-image: -moz-linear-gradient(center top , #3AA7FF 0%, #006EC6 100%);
background-image: -moz-linear-gradient(#3AA7FF 0%, #006EC6 100%);
background-image: -o-linear-gradient(#3AA7FF 0%, #006EC6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3AA7FF), color-stop(100%, #006EC6));
}

Expand Down Expand Up @@ -402,7 +400,7 @@ div.steps {
}

button.delete {
background-color: #37A6FF;
background-color: #EA7676;
height: 24px;
vertical-align: middle;
border: 1px solid #B13D3D;
Expand All @@ -423,7 +421,8 @@ button.delete {
-o-border-radius: 5px;
border-radius: 5px;

background-image: -moz-linear-gradient(center top , #EA7676 0pt, #C84343 100%);
background-image: -moz-linear-gradient(#EA7676 0%, #C84343 100%);
background-image: -o-linear-gradient(#EA7676 0%, #C84343 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #EA7676), color-stop(100%, #C84343));
}

Expand All @@ -439,6 +438,7 @@ button.delete:active {
box-shadow: 0 0 5px #003763 inset;

background-image: -moz-linear-gradient(center top , #C84343 0%, #AA3D3D 100%);
background-image: -o-linear-gradient(#C84343 0%, #AA3D3D 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #C84343), color-stop(100%, #AA3D3D));
}

Expand Down Expand Up @@ -508,7 +508,8 @@ h1 {
-o-border-radius: 5px;
border-radius: 5px;

background-image: -moz-linear-gradient(center top , #76C2FF 0pt, #37A6FF 100%);
background-image: -moz-linear-gradient(#76C2FF 0pt, #37A6FF 100%);
background-image: -o-linear-gradient(#76C2FF 0pt, #37A6FF 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #76C2FF), color-stop(100%, #37A6FF));
}

Expand All @@ -523,7 +524,8 @@ h1 {
-o-box-shadow: 0 0 5px #003763 inset;
box-shadow: 0 0 5px #003763 inset;

background-image: -moz-linear-gradient(center top , #3AA7FF 0%, #006EC6 100%);
background-image: -moz-linear-gradient(#3AA7FF 0%, #006EC6 100%);
background-image: -o-linear-gradient(#3AA7FF 0%, #006EC6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3AA7FF), color-stop(100%, #006EC6));
}

Expand Down
37 changes: 19 additions & 18 deletions browserid/static/dialog/controllers/authenticate_controller.js
Expand Up @@ -40,20 +40,21 @@
var ANIMATION_TIME = 250,
bid = BrowserID,
user = bid.User,
validation = bid.Validation;
validation = bid.Validation,
lastEmail = "";

function checkEmail(el, event) {
var email = $("#email").val(),
self = this;

cancelEvent(event);

if(!validation.email(email)) {
if (!validation.email(email)) {
return;
}

user.isEmailRegistered(email, function onComplete(registered) {
if(registered) {
if (registered) {
enterPasswordState.call(self);
}
else {
Expand All @@ -68,12 +69,12 @@

cancelEvent(event);

if(!validation.email(email)) {
if (!validation.email(email)) {
return;
}

user.createUser(email, function(keypair) {
if(keypair) {
if (keypair) {
self.close("user_staged", {
email: email,
keypair: keypair
Expand All @@ -92,16 +93,11 @@

cancelEvent(event);

if(!validation.emailAndPassword(email, pass)) {
if (!validation.emailAndPassword(email, pass)) {
return;
}

user.authenticateAndSync(email, pass,
function onAuthenticate(authenticated) {
if (authenticated) {
self.doWait(bid.Wait.authentication);
}
},
user.authenticate(email, pass,
function onComplete(authenticated) {
if (authenticated) {
self.close("authenticated", {
Expand Down Expand Up @@ -145,7 +141,7 @@
}

function enterEmailState(el, event) {
if(event && event.which === 13) {
if (event && event.which === 13) {
// Enter key, do nothing
return;
}
Expand Down Expand Up @@ -193,24 +189,29 @@
init: function(el, options) {
options = options || {};

this._super({
this._super(el, {
bodyTemplate: "authenticate.ejs",
bodyVars: {
sitename: user.getOrigin(),
siteicon: "/i/times.gif",
sitename: user.getHostname(),
email: options.email || ""
}
});

this.submit = checkEmail;
// If we already have an email address, check if it is valid, if so, show
// password.
if(options.email) {
if (options.email) {
this.submit();
}
},

"#email keyup": enterEmailState,
"#email keyup": function(el, event) {
var newEmail = el.val();
if (newEmail !== lastEmail) {
lastEmail = newEmail;
enterEmailState.call(this, el);
}
},
"#forgotPassword click": forgotPasswordState,
"#cancel_forgot_password click": cancelForgotPassword
});
Expand Down
Expand Up @@ -42,9 +42,9 @@
PageController.extend("Checkregistration", {}, {
init: function(el, options) {
var me=this;
me._super({
bodyTemplate: "confirmemail.ejs",
bodyVars: {
me._super(el, {
waitTemplate: "confirmemail.ejs",
waitVars: {
email: options.email
}
});
Expand Down
5 changes: 4 additions & 1 deletion browserid/static/dialog/controllers/dialog_controller.js
Expand Up @@ -61,6 +61,9 @@
this.onerror = onerror;

user.setOrigin(origin_url);

// get the cleaned origin.
$("#sitename").text(user.getHostname());

this.doCheckAuth();

Expand Down Expand Up @@ -207,7 +210,7 @@
user.checkAuthenticationAndSync(function onSuccess() {},
function onComplete(authenticated) {
if (authenticated) {
self.doPickEmail();
self.doPickEmail();
} else {
self.doAuthenticate();
}
Expand Down
65 changes: 36 additions & 29 deletions browserid/static/dialog/controllers/page_controller.js
Expand Up @@ -42,13 +42,23 @@

$.Controller.extend("PageController", {
}, {
init: function(options) {
init: function(el, options) {
options = options || {};

var me=this,
bodyTemplate = options.bodyTemplate,
bodyVars = options.bodyVars;
bodyVars = options.bodyVars,
waitTemplate = options.waitTemplate,
waitVars = options.waitVars;


me.renderTemplates(bodyTemplate, bodyVars);
if(bodyTemplate) {
me.renderDialog(bodyTemplate, bodyVars);
}

if(waitTemplate) {
me.renderWait(waitTemplate, waitVars);
}

// XXX move all of these, bleck.
$("form").bind("submit", me.onSubmit.bind(me));
Expand All @@ -69,18 +79,32 @@
this._super();
},

renderTemplates: function(body, body_vars) {

renderTemplates: function(target, body, body_vars) {
if (body) {
var bodyHtml = $.View("//dialog/views/" + body, body_vars);
var form = $("#formWrap > form");
form.html(bodyHtml).hide().fadeIn(ANIMATION_TIME, function() {
$("body").removeClass("waiting");
form.find("input").eq(0).focus();
});
target = $(target + " .contents");
target.html(bodyHtml).find("input").eq(0).focus();
}
},

renderDialog: function(body, body_vars) {
this.renderTemplates("#formWrap", body, body_vars);
$("body").removeClass("error").removeClass("waiting").addClass("form");
$("#wait, #error").stop().fadeOut(ANIMATION_TIME);
},

renderWait: function(body, body_vars) {
this.renderTemplates("#wait", body, body_vars);
$("body").removeClass("error").removeClass("form").addClass("waiting");
$("#wait").stop().css('opacity', 1).hide().fadeIn(ANIMATION_TIME);
},

renderError: function(error_vars) {
this.renderTemplates("#error", "wait.ejs", error_vars);
$("body").removeClass("waiting").removeClass("form").addClass("error");
$("#error").stop().css('opacity', 1).hide().fadeIn(ANIMATION_TIME);
},

onSubmit: function(event) {
event.stopPropagation();
event.preventDefault();
Expand All @@ -100,7 +124,7 @@
},

doWait: function(info) {
this.renderTemplates("wait.ejs", {title: info.message, message: info.description});
this.renderWait("wait.ejs", info);

$("body").addClass("waiting");
},
Expand All @@ -112,23 +136,6 @@
}
},

/**
* Immediately show the error dialog
* @method errorDialog
* @param {object} info - info to use for the error dialog. Should have
* two fields, message, description.
*/
errorDialog: function(info) {
$("form").hide();

$("#error_dialog .title").text(info.message);
$("#error_dialog .content").text(info.description);

$("body").removeClass("authenticated").addClass("error");

$("#error_dialog").fadeIn(ANIMATION_TIME);
},

/**
* Get a curried function to an error dialog.
* @method getErrorDialog
Expand All @@ -137,7 +144,7 @@
*/
getErrorDialog: function(info) {
var self=this;
return self.errorDialog.bind(self, info);
return self.renderError.bind(self, info);
},

onCancel: function(event) {
Expand Down

0 comments on commit ab0307d

Please sign in to comment.