summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorausiv4 <ausiv4@eb105b4a-77de-11de-a249-6bf219df57d5>2009-07-25 17:13:27 +0000
committerausiv4 <ausiv4@eb105b4a-77de-11de-a249-6bf219df57d5>2009-07-25 17:13:27 +0000
commit422e476f496d944f0713484cbe0ee11b180cb12d (patch)
tree3e2bc0bacfd168f0cc95ea93b4f68d0128271c35 /javascript
parentc83993abf777096e8d174d2162d0974f11758797 (diff)
Moved register and login page to templates rather than cluttering views.py. Also added a 'key' function to the SRP javascript library, in case anyone wants to use K for encrypting communications.
Diffstat (limited to 'javascript')
-rw-r--r--javascript/srp.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/javascript/srp.js b/javascript/srp.js
index a1bddff..0eff0ad 100644
--- a/javascript/srp.js
+++ b/javascript/srp.js
@@ -22,6 +22,7 @@ function SRP(username, password, ser, base_url)
var url = base_url;
var server = ser;
var that = this;
+ var authenticated = false;
function paths(str)
{
@@ -160,7 +161,10 @@ function SRP(username, password, ser, base_url)
if(xhr.responseXML.getElementsByTagName("M").length > 0)
{
if(innerxml(xhr.responseXML.getElementsByTagName("M")[0]) == M2)
+ {
that.success();
+ authenticated = true;
+ }
else
that.error_message("Server key does not match");
}
@@ -170,6 +174,19 @@ function SRP(username, password, ser, base_url)
}
}
};
+ this.key = function()
+ {
+ if(K == null)
+ if(authenticated)
+ {
+ K = SHA256(S);
+ return K;
+ }
+ else
+ that.error_message("User has not been authenticated.");
+ else
+ return K;
+ }
this.success = function()
{
alert("Authentication successful.");