From 3c5fa6f8b5e4f8763dff50cae2e38008cecc9b43 Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Tue, 19 Jun 2012 09:34:05 +0100
Subject: [PATCH] Make the forgot and verify_email_address pages cachable.

issue #1793
---
 lib/browserid/views.js      | 8 ++------
 tests/cache-header-tests.js | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/browserid/views.js b/lib/browserid/views.js
index d4d120452..b26361e2c 100644
--- a/lib/browserid/views.js
+++ b/lib/browserid/views.js
@@ -139,12 +139,10 @@ exports.setup = function(app) {
   });
 
   app.get("/forgot", function(req, res) {
-    // !cachable!  email embedded in DOM
     res.local('util', util);
-    res.render('forgot.ejs', {
+    renderCachableView(req, res, 'forgot.ejs', {
       title: 'Forgot Password',
       fullpage: false,
-      email: req.query.email,
       enable_development_menu: config.get('enable_development_menu')
     });
   });
@@ -166,12 +164,10 @@ exports.setup = function(app) {
   });
 
   app.get("/verify_email_address", function(req, res) {
-    // !cachable!  token is embedded in DOM
     res.local('util', util);
-    res.render('verify_email_address.ejs', {
+    renderCachableView(req, res, 'verify_email_address.ejs', {
       title: 'Complete Registration',
       fullpage: true,
-      token: req.query.token,
       enable_development_menu: config.get('enable_development_menu')
     });
   });
diff --git a/tests/cache-header-tests.js b/tests/cache-header-tests.js
index 4713b0d6b..9649791ba 100755
--- a/tests/cache-header-tests.js
+++ b/tests/cache-header-tests.js
@@ -125,12 +125,12 @@ suite.addBatch({
   '/authenticate_with_primary': hasProperCacheHeaders('/authenticate_with_primary'),
   '/signup': hasProperCacheHeaders('/signup'),
   '/idp_auth_complete': hasProperCacheHeaders('/idp_auth_complete'),
-//  '/forgot': hasProperCacheHeaders('/forgot'), */
+  '/forgot': hasProperCacheHeaders('/forgot'),
   '/signin': hasProperCacheHeaders('/signin'),
   '/about': hasProperCacheHeaders('/about'),
   '/tos': hasProperCacheHeaders('/tos'),
   '/privacy': hasProperCacheHeaders('/privacy'),
-//  '/verify_email_address': hasProperCacheHeaders('/verify_email_address'), */
+  '/verify_email_address': hasProperCacheHeaders('/verify_email_address'),
   '/add_email_address': hasProperCacheHeaders('/add_email_address'),
 //  '/pk': hasProperCacheHeaders('/pk'),
 //  '/.well-known/browserid': hasProperCacheHeaders('/.well-known/browserid')
-- 
GitLab