diff options
author | Azul <azul@riseup.net> | 2015-09-17 19:48:36 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2015-09-17 19:48:36 +0200 |
commit | 9e1a41733468d4a3f5102b04277b9cd7b52d0a45 (patch) | |
tree | 9d2edbecffaeb95400601475727d422668ea296c /src | |
parent | ff0b3facac13513832d05346c5308b6a4a558f2b (diff) | |
parent | 2d24b1fe1918ad96df4469f8902c3ddcb9bda5f9 (diff) |
Merge remote-tracking branch 'alster/feature/extra-signup-params'
Diffstat (limited to 'src')
-rw-r--r-- | src/jqueryRest.js | 2 | ||||
-rw-r--r-- | src/srp_session.js | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/jqueryRest.js b/src/jqueryRest.js index 103f700..0c58eb2 100644 --- a/src/jqueryRest.js +++ b/src/jqueryRest.js @@ -11,7 +11,7 @@ srp.remote = (function(){ url: "/1/users/" + session.id() + ".json", type: 'PUT', headers: { Authorization: 'Token token="' + token + '"' }, - data: {user: session.signup() } + data: {user: session.update() } }); } diff --git a/src/srp_session.js b/src/srp_session.js index bdff9c4..88f19d5 100644 --- a/src/srp_session.js +++ b/src/srp_session.js @@ -22,7 +22,7 @@ srp.Session = function(account, calculate) { return A; }; - this.signup = function() { + this.update = function() { var salt = calculate.randomSalt(); var x = calculate.X(account.login(), account.password(), salt); return { @@ -30,6 +30,19 @@ srp.Session = function(account, calculate) { password_salt: salt, password_verifier: calculate.V(x) }; + } + + this.signup = function() { + var loginParams = this.update(); + + if (account.loginParams) { + var extraParams = account.loginParams(); + for (var attr in extraParams) { + loginParams[attr] = extraParams[attr]; + } + } + + return loginParams; }; this.handshake = function() { |