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	Sat Dec 28 14:26:29 2013 -0800
+++ b/bitsyauth/__init__.py	Sun Dec 29 20:20:38 2013 -0800
@@ -49,11 +49,14 @@
         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:
--- a/example/persona.html	Sat Dec 28 14:26:29 2013 -0800
+++ b/example/persona.html	Sun Dec 29 20:20:38 2013 -0800
@@ -22,15 +22,14 @@
     // 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() {
@@ -38,12 +37,12 @@
     // 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); }
+    // });
   }
 });