This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

integrating train 2011.10.06

  • Loading branch information...
lloyd committed Oct 13, 2011
2 parents 13d9e8a + 85d8db3 commit 20c0f264412aa1272b49b9aba907282924ea49be
Showing with 6,081 additions and 2,637 deletions.
  1. +19 −0 ChangeLog
  2. +2 −3 README.md
  3. +21 −14 browserid/app.js
  4. +8 −4 browserid/compress.sh
  5. +1 −0 browserid/lib/db.js
  6. +13 −7 browserid/lib/db_json.js
  7. +25 −14 browserid/lib/db_mysql.js
  8. +10 −2 browserid/lib/email.js
  9. +154 −105 browserid/lib/wsapi.js
  10. +0 −129 browserid/static/css/github.css
  11. +219 −0 browserid/static/css/m.css
  12. +890 −212 browserid/static/css/style.css
  13. +156 −34 browserid/static/dialog/controllers/authenticate_controller.js
  14. +22 −62 browserid/static/dialog/controllers/checkregistration_controller.js
  15. +0 −164 browserid/static/dialog/controllers/createaccount_controller.js
  16. +71 −80 browserid/static/dialog/controllers/dialog_controller.js
  17. +0 −111 browserid/static/dialog/controllers/forgotpassword_controller.js
  18. +29 −24 browserid/static/dialog/controllers/page_controller.js
  19. +170 −0 browserid/static/dialog/controllers/pickemail_controller.js
  20. +104 −0 browserid/static/dialog/css/m.css
  21. +553 −0 browserid/static/dialog/css/popup.css
  22. +5 −19 browserid/static/dialog/dialog.js
  23. +1 −1 browserid/static/dialog/resources/browserid-errors.js
  24. +26 −15 browserid/static/dialog/resources/browserid-extensions.js
  25. +303 −157 browserid/static/dialog/resources/browserid-identities.js
  26. +277 −165 browserid/static/dialog/resources/browserid-network.js
  27. +1 −1 browserid/static/dialog/resources/browserid-wait.js
  28. +42 −0 browserid/static/dialog/resources/browserid.js
  29. +41 −2 browserid/static/dialog/resources/storage.js
  30. +108 −0 browserid/static/dialog/resources/tooltip.js
  31. +122 −0 browserid/static/dialog/resources/validation.js
  32. +0 −285 browserid/static/dialog/style.css
  33. +47 −47 browserid/static/dialog/test/qunit/browserid-identities_functional_test.js
  34. +302 −114 browserid/static/dialog/test/qunit/browserid-identities_unit_test.js
  35. +418 −71 browserid/static/dialog/test/qunit/browserid-network_test.js
  36. +44 −0 browserid/static/dialog/test/qunit/browserid_unit_test.js
  37. +8 −5 browserid/static/dialog/test/qunit/qunit.js
  38. +109 −0 browserid/static/dialog/test/qunit/storage_unit_test.js
  39. +181 −0 browserid/static/dialog/test/qunit/validation_unit_test.js
  40. +0 −9 browserid/static/dialog/views/addemail.ejs
  41. +76 −16 browserid/static/dialog/views/authenticate.ejs
  42. +0 −25 browserid/static/dialog/views/body.ejs
  43. +0 −3 browserid/static/dialog/views/bottom-addemail.ejs
  44. +0 −2 browserid/static/dialog/views/bottom-confirmemail.ejs
  45. +0 −3 browserid/static/dialog/views/bottom-continue.ejs
  46. +0 −2 browserid/static/dialog/views/bottom-pickemail.ejs
  47. +0 −2 browserid/static/dialog/views/bottom-signin.ejs
  48. +0 −3 browserid/static/dialog/views/bottom.ejs
  49. +10 −13 browserid/static/dialog/views/confirmemail.ejs
  50. +0 −26 browserid/static/dialog/views/create.ejs
  51. +0 −24 browserid/static/dialog/views/forgotpassword.ejs
  52. +72 −0 browserid/static/dialog/views/pickemail.ejs
  53. +0 −12 browserid/static/dialog/views/signin.ejs
  54. +2 −1 browserid/static/dialog/views/wait.ejs
  55. BIN browserid/static/i/arrow.png
  56. BIN browserid/static/i/bg.png
  57. BIN browserid/static/i/blink.gif
  58. BIN browserid/static/i/browserid_logo.png
  59. BIN browserid/static/i/card.png
  60. BIN browserid/static/i/count.png
  61. BIN browserid/static/i/developers.png
  62. BIN browserid/static/i/hint.png
  63. BIN browserid/static/i/icon.png
  64. BIN browserid/static/i/id.png
  65. BIN browserid/static/i/labs-logo.png
  66. BIN browserid/static/i/people.png
  67. BIN browserid/static/i/slit.png
  68. BIN browserid/static/i/times.gif
  69. BIN browserid/static/i/tutorial_1.png
  70. BIN browserid/static/i/tutorial_2.png
  71. BIN browserid/static/i/tutorial_3.png
  72. +232 −191 browserid/static/include.js
  73. +70 −68 browserid/static/js/browserid.js
  74. +1 −1 browserid/static/js/html5shim.js
  75. +26 −30 browserid/static/{dialog/controllers/chooseemail_controller.js → js/pages/add_email_address.js}
  76. +69 −0 browserid/static/js/pages/forgot.js
  77. +54 −0 browserid/static/js/pages/index.js
  78. +201 −0 browserid/static/js/pages/manage_account.js
  79. +72 −0 browserid/static/js/pages/signin.js
  80. +52 −35 browserid/static/{dialog/controllers/addemail_controller.js → js/pages/signup.js}
  81. +91 −0 browserid/static/js/pages/verify_email_address.js
  82. +1 −1 browserid/tests/ca-test.js
  83. +1 −14 browserid/tests/cert-emails-test.js
  84. +11 −7 browserid/tests/db-test.js
  85. +5 −9 browserid/tests/forgotten-email-test.js
  86. +4 −6 browserid/tests/list-emails-wsapi-test.js
  87. +25 −15 browserid/tests/password-length-test.js
  88. +44 −23 browserid/tests/registration-status-wsapi-test.js
  89. +37 −0 browserid/views/about.ejs
  90. +0 −105 browserid/views/developers.ejs
  91. +57 −3 browserid/views/dialog.ejs
  92. +28 −0 browserid/views/forgot.ejs
  93. +37 −9 browserid/views/index.ejs
  94. +60 −37 browserid/views/layout.ejs
  95. +0 −10 browserid/views/manage.ejs
  96. +0 −12 browserid/views/primaries.ejs
  97. +5 −3 browserid/views/privacy.ejs
  98. +0 −51 browserid/views/prove.ejs
  99. +51 −0 browserid/views/signin.ejs
  100. +38 −0 browserid/views/signup.ejs
  101. +4 −3 browserid/views/tos.ejs
  102. +0 −8 browserid/views/users.ejs
  103. +18 −0 browserid/views/verifyemail.ejs
  104. +57 −0 browserid/views/verifyuser.ejs
  105. +2 −2 package.json
  106. +60 −0 scripts/assign_issues.js
  107. +2 −0 scripts/update_schema.sql
  108. +3 −5 verifier/app.js
  109. +1 −1 verifier/lib/certassertion.js
View
@@ -1,3 +1,22 @@
+train-2011.10.06:
+ * full site & dialog redesign: (many, many closed issues are related to this, including #269, #343, #342, #347, #354, #356, #357, #350, #349, #364, #346, #336)
+ * improved debugging, all network callbacks are invoked asynchronously: #276
+ * MYSQL SCHEMA CHANGE: passwd field no longer in staged table (password is now set after verfiy link clickthrough)
+ * MYSQL SCHEMA CHANGE: add index to emails table: #209
+ * WSAPI CHANGES (to support new UI): https://github.com/mozilla/browserid/commit/b6ee51
+ * WSAPI CHANGES: a mis-set client clock no longer causes invalid assertions to be issued (wsapi changed to minimize network requests): #329
+ * disallow re-registration of existing account: #333
+ * (non-visible) namespacing in dialog code: #275
+ * API BREAKING CHANGE: verifier no longer supports GET requests: #98
+ * significant performance / UX improvment - keys are generated and certified when needed, not all upfront at sign-in: #278
+ * remove 'download printable format' language from privacy policy: #280
+ * faster keygen via crypto optimizations: https://github.com/mozilla/browserid/commit/778433
+ * improvements to mobile layout & usability (specific to the new UI)
+ * more user visible error messages to improve community sourced problem reports: #335
+ * IE8 improvements (still not fully supported): #246, #361, #346
+ * cookie fixes revisited, now on upstream version of connect-cookie-session: #310
+ * (merged 2011.10.07) fix unstyled flash at first dialog display: #365
+
train-2011.09.29:
* shortly after dialog is spawned, we remove the four random chars in the fragment (aesthetic)
* fix bug where session duration had an upper bound of 7 days - the time the server was running: #310
View
@@ -42,9 +42,8 @@ Here's the software you'll need installed:
* node.js (>= 0.4.5): http://nodejs.org/
* npm: http://npmjs.org/
-* Several node.js 3rd party libraries - see `package.json` for details
-* browserify which will be installed globally.
-* git, g++
+* git
+* g++
## Getting started:
View
@@ -102,34 +102,41 @@ function router(app) {
res.render('index.ejs', {title: 'A Better Way to Sign In', fullpage: true});
});
- app.get(/^\/prove(\.html)?$/, function(req,res) {
- res.render('prove.ejs', {title: 'Verify Email Address', fullpage: false});
+ // BA removed .html URLs. If we have 404s,
+ // we should set up some redirects
+
+ app.get("/signup", function(req, res) {
+ res.render('signup.ejs', {title: 'Sign Up', fullpage: false});
});
- app.get(/^\/users(\.html)?$/, function(req,res) {
- res.render('users.ejs', {title: 'for Users', fullpage: false});
+ app.get("/forgot", function(req, res) {
+ res.render('forgot.ejs', {title: 'Forgot Password', fullpage: false, email: req.query.email});
});
- app.get(/^\/developers(\.html)?$/, function(req,res) {
- res.render('developers.ejs', {title: 'for Developers', fullpage: false});
+ app.get("/signin", function(req, res) {
+ res.render('signin.ejs', {title: 'Sign In', fullpage: false});
});
- app.get(/^\/primaries(\.html)?$/, function(req,res) {
- res.render('primaries.ejs', {title: 'for Primary Authorities', fullpage: false});
+ app.get("/about", function(req, res) {
+ res.render('about.ejs', {title: 'About', fullpage: false});
});
- app.get(/^\/manage(\.html)?$/, function(req,res) {
- res.render('manage.ejs', {title: 'My Account', fullpage: false});
- });
-
- app.get(/^\/tos(\.html)?$/, function(req, res) {
+ app.get("/tos", function(req, res) {
res.render('tos.ejs', {title: 'Terms of Service', fullpage: false});
});
- app.get(/^\/privacy(\.html)?$/, function(req, res) {
+ app.get("/privacy", function(req, res) {
res.render('privacy.ejs', {title: 'Privacy Policy', fullpage: false});
});
+ app.get("/verify_email_address", function(req, res) {
+ res.render('verifyuser.ejs', {title: 'Complete Registration', fullpage: true, token: req.query.token});
+ });
+
+ app.get("/add_email_address", function(req,res) {
+ res.render('verifyemail.ejs', {title: 'Verify Email Address', fullpage: false});
+ });
+
// register all the WSAPI handlers
wsapi.setup(app);
View
@@ -12,7 +12,7 @@ if [ ! -x "$JAVA" ]; then
exit 1
fi
-YUI_LOCATION='../../static/steal/build/scripts/yui.jar'
+YUI_LOCATION=`pwd`'/static/steal/build/scripts/yui.jar'
echo ''
echo '****Compressing include.js****'
@@ -32,7 +32,11 @@ cd dialog
$UGLIFY < production.js > production.min.js
mv production.min.js production.js
-cd ../relay
+cd css
+cat popup.css m.css > production.css
+$JAVA -jar $YUI_LOCATION production.css -o production.min.css
+
+cd ../../relay
cat ../dialog/resources/jschannel.js relay.js > production.js
$UGLIFY < production.js > production.min.js
mv production.min.js production.js
@@ -44,9 +48,9 @@ echo ''
cd ../js
# re-minimize everything together
-cat jquery-1.6.2.min.js json2.js ../dialog/resources/underscore-min.js ../dialog/resources/storage.js ../dialog/resources/browserid-network.js ../dialog/resources/browserid-identities.js browserid.js > lib.js
+cat jquery-1.6.2.min.js json2.js browserid.js ../dialog/resources/underscore-min.js ../dialog/resources/browserid-extensions.js ../dialog/resources/storage.js ../dialog/resources/browserid-network.js ../dialog/resources/browserid-identities.js ../dialog/resources/tooltip.js ../dialog/resources/validation.js pages/index.js pages/add_email_address.js pages/verify_email_address.js pages/manage_account.js pages/signin.js pages/signup.js pages/forgot.js > lib.js
$UGLIFY < lib.js > lib.min.js
cd ../css
-cat github.css style.css > browserid.css
+cat style.css m.css > browserid.css
$JAVA -jar $YUI_LOCATION browserid.css -o browserid.min.css
View
@@ -99,6 +99,7 @@ exports.onReady = function(f) {
'stageUser',
'stageEmail',
'gotVerificationSecret',
+ 'emailForVerificationSecret',
'checkAuth',
'listEmails',
'removeEmail',
View
@@ -146,17 +146,16 @@ function addEmailToAccount(existing_email, email, cb) {
});
}
-exports.stageUser = function(obj, cb) {
+exports.stageUser = function(email, cb) {
var secret = secrets.generate(48);
// overwrite previously staged users
staged[secret] = {
type: "add_account",
- email: obj.email,
- pass: obj.hash
+ email: email
};
- stagedEmails[obj.email] = secret;
+ stagedEmails[email] = secret;
setTimeout(function() { cb(secret); }, 0);
};
@@ -172,7 +171,14 @@ exports.stageEmail = function(existing_email, new_email, cb) {
setTimeout(function() { cb(secret); }, 0);
};
-exports.gotVerificationSecret = function(secret, cb) {
+
+exports.emailForVerificationSecret = function(secret, cb) {
+ setTimeout(function() {
+ cb(staged[secret]? staged[secret].email:undefined);
+ }, 0);
+};
+
+exports.gotVerificationSecret = function(secret, hash, cb) {
if (!staged.hasOwnProperty(secret)) return cb("unknown secret");
// simply move from staged over to the emails "database"
@@ -183,11 +189,11 @@ exports.gotVerificationSecret = function(secret, cb) {
exports.emailKnown(o.email, function(known) {
function createAccount() {
db.push({
- password: o.pass,
+ password: hash,
emails: [ o.email ]
});
flush();
- cb();
+ cb(undefined, o.email);
}
// if this email address is known and a user has completed a re-verification of this email
View
@@ -41,7 +41,7 @@
/*
* The Schema:
*
- * +--- user ------+ +--- email ----+
+ * +--- user ------+ +--- email ----+
* |*int id | <-\ |*int id |
* | string passwd | \- |*int user |
* +---------------+ |*string address
@@ -53,7 +53,6 @@
* | bool new_acct |
* | string existing |
* |*string email |
- * | string passwd |
* | timestamp ts |
* +------------------------+
*/
@@ -70,8 +69,8 @@ var drop_on_close = undefined;
const schemas = [
"CREATE TABLE IF NOT EXISTS user ( id INTEGER AUTO_INCREMENT PRIMARY KEY, passwd VARCHAR(64) );",
- "CREATE TABLE IF NOT EXISTS email ( id INTEGER AUTO_INCREMENT PRIMARY KEY, user INTEGER, address VARCHAR(255) UNIQUE, INDEX(address) );",
- "CREATE TABLE IF NOT EXISTS staged ( secret VARCHAR(48) PRIMARY KEY, new_acct BOOL, existing VARCHAR(255), email VARCHAR(255) UNIQUE, INDEX(email), passwd VARCHAR(64), ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);"
+ "CREATE TABLE IF NOT EXISTS email ( id INTEGER AUTO_INCREMENT PRIMARY KEY, user INTEGER, INDEX(user), address VARCHAR(255) UNIQUE, INDEX(address) );",
+ "CREATE TABLE IF NOT EXISTS staged ( secret VARCHAR(48) PRIMARY KEY, new_acct BOOL, existing VARCHAR(255), email VARCHAR(255) UNIQUE, INDEX(email), ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);"
];
// log an unexpected database error
@@ -184,12 +183,12 @@ exports.isStaged = function(email, cb) {
);
}
-exports.stageUser = function(obj, cb) {
+exports.stageUser = function(email, cb) {
var secret = secrets.generate(48);
// overwrite previously staged users
- client.query('INSERT INTO staged (secret, new_acct, email, passwd) VALUES(?,TRUE,?,?) ' +
- 'ON DUPLICATE KEY UPDATE secret=?, existing="", new_acct=TRUE, passwd=?',
- [ secret, obj.email, obj.hash, secret, obj.hash],
+ client.query('INSERT INTO staged (secret, new_acct, email) VALUES(?,TRUE,?) ' +
+ 'ON DUPLICATE KEY UPDATE secret=?, existing="", new_acct=TRUE',
+ [ secret, email, secret],
function(err) {
if (err) {
logUnexpectedError(err);
@@ -198,7 +197,16 @@ exports.stageUser = function(obj, cb) {
});
}
-exports.gotVerificationSecret = function(secret, cb) {
+exports.emailForVerificationSecret = function(secret, cb) {
+ client.query(
+ "SELECT email FROM staged WHERE secret = ?", [ secret ],
+ function(err, rows) {
+ if (err) logUnexpectedError(err);
+ cb((rows && rows.length > 0) ? rows[0].email : undefined);
+ });
+};
+
+exports.gotVerificationSecret = function(secret, hash, cb) {
client.query(
"SELECT * FROM staged WHERE secret = ?", [ secret ],
function(err, rows) {
@@ -227,7 +235,7 @@ exports.gotVerificationSecret = function(secret, cb) {
[ userID, o.email ],
function(err, info) {
if (err) logUnexpectedError(err);
- cb(err ? err : undefined);
+ cb(err ? err : undefined, o.email);
});
}
});
@@ -240,7 +248,7 @@ exports.gotVerificationSecret = function(secret, cb) {
// we're creating a new account, add appropriate entries into user and email tables.
client.query(
"INSERT INTO user(passwd) VALUES(?)",
- [ o.passwd ],
+ [ hash ],
function(err, info) {
if (err) { logUnexpectedError(err); cb(err); return; }
addEmailToUser(info.insertId);
@@ -277,7 +285,7 @@ exports.stageEmail = function(existing_email, new_email, cb) {
var secret = secrets.generate(48);
// overwrite previously staged users
client.query('INSERT INTO staged (secret, new_acct, existing, email) VALUES(?,FALSE,?,?) ' +
- 'ON DUPLICATE KEY UPDATE secret=?, existing=?, new_acct=FALSE, passwd=""',
+ 'ON DUPLICATE KEY UPDATE secret=?, existing=?, new_acct=FALSE',
[ secret, existing_email, new_email, secret, existing_email],
function(err) {
if (err) {
@@ -347,8 +355,11 @@ exports.cancelAccount = function(email, cb) {
function (err, rows) {
if (err) {
logUnexpectedError(err)
- cb(err);
- return
+ return cb(err);
+ } else if (!rows || !rows.length === 1 || typeof rows[0] !== 'object') {
+ var e = "no user with given account: " + email ;
+ logUnexpectedError(e)
+ return cb(e);
}
var uid = rows[0].user;
client.query("DELETE LOW_PRIORITY FROM email WHERE user = ?", [ uid ], reportErr);
View
@@ -61,8 +61,8 @@ exports.setInterceptor = function(callback) {
interceptor = callback;
};
-exports.sendVerificationEmail = function(email, site, secret) {
- var url = config.get('URL') + "/prove?token=" + encodeURIComponent(secret);
+function doSend(landing_page, email, site, secret) {
+ var url = config.get('URL') + "/" + landing_page + "?token=" + encodeURIComponent(secret);
if (interceptor) {
interceptor(email, site, secret);
@@ -83,3 +83,11 @@ exports.sendVerificationEmail = function(email, site, secret) {
});
};
};
+
+exports.sendNewUserEmail = function(email, site, secret) {
+ doSend('verify_email_address', email, site, secret);
+};
+
+exports.sendAddAddressEmail = function(email, site, secret) {
+ doSend('add_email_address', email, site, secret);
+};
Oops, something went wrong.

0 comments on commit 20c0f26

Please sign in to comment.