changeset 45:54a53bbe5be9

bitsyauth/__init__.py example/persona.html
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 29 Dec 2013 20:20:38 -0800
parents 158b469a10e9
children 6b53345b9c2e
files bitsyauth/__init__.py example/persona.html
diffstat 2 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyauth/__init__.py
+++ b/bitsyauth/__init__.py
@@ -44,21 +44,24 @@ class BitsyAuthInnerWare(object):
         """
 
         self.app = app
         self.passwords = passwords
         self.site = site or ''
         self.realm = realm or self.site
         self.captcha = True
         self.urls = { 'login': '/login', 'join': '/join', }
+
+        # CAPTCHAs
+        # using skimpygimpy (for now)
         self.keys = {} # keys, words for CAPTCHA request
-
         self.content_type = { 'image_captcha': 'image/png',
                               'wav_captcha': 'audio/wav' }
 
+        # new user creation
         if newuser:
             self.newuser = newuser
         else:
             self.urls.pop('join') # don't do joining
 
         # WSGI app securely wrapped
         self.wrapped_app = self.security_wrapper()
 
--- a/example/persona.html
+++ b/example/persona.html
@@ -17,38 +17,37 @@ var nclicks = 0;
 var currentUser = null;
 
 navigator.id.watch({
   loggedInUser: currentUser,
   onlogin: function(assertion) {
     // A user has logged in! Here you need to:
     // 1. Send the assertion to your backend for verification and to create a session.
     // 2. Update your UI.
-    $.ajax({
-      type: 'POST',
-      url: '/auth/login', // This is a URL on your website.
-      data: {assertion: assertion},
-      success: function(res, status, xhr) { window.location.reload(); },
-      error: function(xhr, status, err) {
-        navigator.id.logout();
-        alert("Login failure: " + err);
-      }
+    $.ajax({type: 'POST',
+            url: '/auth/login', // This is a URL on your website.
+            data: {assertion: assertion},
+            success: function(res, status, xhr) { window.location.reload(); },
+            error: function(xhr, status, err) {
+                       navigator.id.logout();
+                       alert("Login failure: " + err);
+       }
     });
   },
   onlogout: function() {
     // A user has logged out! Here you need to:
     // Tear down the user's session by redirecting the user or making a call to your backend.
     // Also, make sure loggedInUser will get set to null on the next page load.
     // (That's a literal JavaScript null. Not false, 0, or undefined. null.)
-    $.ajax({
-      type: 'POST',
-      url: '/auth/logout', // This is a URL on your website.
-      success: function(res, status, xhr) { window.location.reload(); },
-      error: function(xhr, status, err) { alert("Logout failure: " + err); }
-    });
+    //    $.ajax({
+    //  type: 'POST',
+    //  url: '/auth/logout', // This is a URL on your website.
+    //  success: function(res, status, xhr) { window.location.reload(); },
+    //  error: function(xhr, status, err) { alert("Logout failure: " + err); }
+    // });
   }
 });
 
 
 var signinLink = document.getElementById('signin');
 if (signinLink) {
 signinLink.onclick = function() {
 navigator.id.request();