From b4a9250ae2bc33c10c7fda211ecf2a766eb62f3e Mon Sep 17 00:00:00 2001 From: Ben Adida Date: Thu, 7 Jul 2011 11:41:27 -0700 Subject: [PATCH] moved all static to dynamic views with templates --- browserid/app.js | 12 ++++ browserid/views/developers.ejs | 103 +++++++++++++++++++++++++++++++++ browserid/views/index.ejs | 4 +- browserid/views/layout.ejs | 90 ++++++++++++++-------------- browserid/views/manage.ejs | 10 ++++ browserid/views/primaries.ejs | 16 +++++ 6 files changed, 191 insertions(+), 44 deletions(-) create mode 100644 browserid/views/developers.ejs create mode 100644 browserid/views/manage.ejs create mode 100644 browserid/views/primaries.ejs diff --git a/browserid/app.js b/browserid/app.js index dff83159f..604fe03eb 100644 --- a/browserid/app.js +++ b/browserid/app.js @@ -43,6 +43,18 @@ function router(app) { res.render('users.ejs', {title: 'for Users', fullpage: false}); }); + app.get('/developers', function(req,res) { + res.render('developers.ejs', {title: 'for Developers', fullpage: false}); + }); + + app.get('/primaries', function(req,res) { + res.render('primaries.ejs', {title: 'for Primary Authorities', fullpage: false}); + }); + + app.get('/manage', function(req,res) { + res.render('manage.ejs', {title: 'My Account', fullpage: false}); + }); + app.get('/privacy', function(req, res) { res.render('privacy.ejs', {title: 'Privacy and Terms of Service', fullpage: false}); }); diff --git a/browserid/views/developers.ejs b/browserid/views/developers.ejs new file mode 100644 index 000000000..4d3d03e89 --- /dev/null +++ b/browserid/views/developers.ejs @@ -0,0 +1,103 @@ + + +
+

+ BrowserID provides a simple and sophisticated + login process that your users will love. It can be + integrated in three easy steps: +

+
+
+
1.
+

Enable BrowserID: Include the BrowserID JavaScript library in your site by adding a script tag to your <head>

+ +
<script src="https://browserid.org/include.js" type="text/javascript"></script>
+
+
+
2.
+

+ Identify the User: Instead of displaying a form on your + site which takes a username and password, use the BrowserID + JavaScript API when the user clicks your login button: +

+
navigator.id.getVerifiedEmail(function(assertion) {
+    if (assertion) {
+        // This code will be invoked once the user has successfully
+        // selected an email address they control to log in with.
+    } else {
+        // something went wrong!  the user isn't logged in.
+    }
+});
+
+

+ Upon a successful login, you'll be called back with + an assertion, a string containing a signed claim that proves + the user is who they say they are. +

+

+ NOTE: While completely optional, you might consider + replacing your login/signin button with a pretty BrowserID button: + +

+
+
+
+
+
+
+

+
+
+
3.
+

+ Verify the User's Identity: You must verify the assertion + is authentic, and extract the user's email address from it. + The easiest way to do these is to use the + free verification service provided by BrowserID. +

+ To use it, you send a request + to https://browserid.org/verify with two GET parameters: +

+
    +
  1. assertion: The encoded assertion +
  2. audience: The hostname and optional port of your site +
+

+ The verifier will check the the assertion was meant for your site and + is valid, here's an example: +

+
$ curl "https://browserid.org/verify?assertion=<ASSERTION>&audience=mysite.com"
+{
+    "status": "okay",
+    "email": "lloyd@mozilla.com",
+    "audience": "mysite.com",
+    "valid-until": 1308859352261,
+    "issuer": "browserid.org:443"
+}
+
+

+

+ NOTE: You may choose to validate assertions on your own + server. While a bit more complicated you can reduce your + dependencies on others. Refer + to the + specification and the source for the reference + validator. +

+
+
+

Complete the log in! Having completed the steps + above, you can trust that the present user really owns the + email address returned by the verifier. You don't need to + perform any additional authentication unless you want to! + From here, you can perform whatever post-authentication steps + you like. +

+
+
+

+ You're done! Welcome to BrowserID! For more details, have a look at + our demonstration, and view + the code behind it. +

+
diff --git a/browserid/views/index.ejs b/browserid/views/index.ejs index fffcde351..6d89bc145 100644 --- a/browserid/views/index.ejs +++ b/browserid/views/index.ejs @@ -4,9 +4,9 @@
-

For developers, BrowserID offers a world class login experience with only a couple lines of code. Get Started.

+

For developers, BrowserID offers a world class login experience with only a couple lines of code. Get Started.

-

For identity providers, BrowserID lets your give your users an identity they can use everywhere. Dig Deeper.

+

For identity providers, BrowserID lets your give your users an identity they can use everywhere. Dig Deeper.

diff --git a/browserid/views/layout.ejs b/browserid/views/layout.ejs index 16768db9c..673bc45c3 100644 --- a/browserid/views/layout.ejs +++ b/browserid/views/layout.ejs @@ -4,45 +4,16 @@ <%- title %> - - -
- <% if (fullpage) { %> - -
-
-
A better way to log in.
-
- <% } else { %> -
-
-
-
<%- title %>
-
-
- <% } %> -
- <%- body %> -
- -
- - - + + + - + + +
+ + <% if (fullpage) { %> +
+
+
A better way to log in.
+
+ <% } else { %> +
+
+
+
<%- title %>
+
+
+ <% } %> +
+ <%- body %> +
+ +
+ diff --git a/browserid/views/manage.ejs b/browserid/views/manage.ejs new file mode 100644 index 000000000..f48ac42d9 --- /dev/null +++ b/browserid/views/manage.ejs @@ -0,0 +1,10 @@ +
+

+ Manage your email addresses in BrowserID. +

+
+
+
+
+ You may, at any time, cancel your account. +
diff --git a/browserid/views/primaries.ejs b/browserid/views/primaries.ejs new file mode 100644 index 000000000..30bef1ff6 --- /dev/null +++ b/browserid/views/primaries.ejs @@ -0,0 +1,16 @@ +
+

+ This page is dedicated to the Identity Providers. + These are dudes like Yahoo!, Google, Twitter, Facebook, and + even github. If someone new wants to join they party, hey, + they should + be able to. +

+

+ But there's a catch. This page hasn't been written yet! No no, don't + get frustrated, just go write something and + then contribute + it on github. +

+


+