diff options
author | Azul <azul@riseup.net> | 2012-10-19 17:49:53 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-10-19 17:49:53 +0200 |
commit | 8c1cc0f4903b1b6eabffe6681744ea02a870af7f (patch) | |
tree | e8062b5173f46eb2884346b3fb04634e1084d7ca /src | |
parent | 5a0ceeb1ca0055719a9b8977a799362163955766 (diff) |
added success and error callbacks to register
Diffstat (limited to 'src')
-rw-r--r-- | src/srp.js | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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; + } + } }; |