summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2012-10-19 17:49:53 +0200
committerAzul <azul@riseup.net>2012-10-19 17:49:53 +0200
commit8c1cc0f4903b1b6eabffe6681744ea02a870af7f (patch)
treee8062b5173f46eb2884346b3fb04634e1084d7ca /src
parent5a0ceeb1ca0055719a9b8977a799362163955766 (diff)
added success and error callbacks to register
Diffstat (limited to 'src')
-rw-r--r--src/srp.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/srp.js b/src/srp.js
index c986443..7060598 100644
--- a/src/srp.js
+++ b/src/srp.js
@@ -11,8 +11,7 @@ function SRP(remote, session)
// Start the login process by identifying the user
this.identify = function(success, error)
{
- srp.success = success;
- srp.error = error;
+ store_callbacks(success, error);
remote.handshake(session, receive_salts);
// Receive login salts from the server, start calculations
@@ -45,8 +44,9 @@ function SRP(remote, session)
};
// Initiate the registration process
- this.register = function()
+ this.register = function(success, error)
{
+ store_callbacks(success, error);
remote.register(session, srp.registered_user);
};
@@ -71,5 +71,14 @@ function SRP(remote, session)
{
alert("Login successful.");
};
+
+ function store_callbacks(success, error) {
+ if (typeof success == "function") {
+ srp.success = success;
+ }
+ if (typeof error == "function") {
+ srp.error = error;
+ }
+ }
};