diff options
author | Thais Siqueira <thais.siqueira@gmail.com> | 2017-03-02 16:23:17 -0300 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-03-30 17:00:06 +0200 |
commit | caed945c7c85800d7467f52471509afc21a6f071 (patch) | |
tree | 4b1c3167e49044f14c0192e842bfd30fc92e8912 /src/leap/bitmask/bonafide/session.py | |
parent | bd853141a23055cf2d1e0a4ae1712577024f9b84 (diff) |
[feature] Creates methods for update recovery code.
Related with: https://github.com/pixelated/pixelated-user-agent/issues/924
with @aarni
Signed-off-by: Ruben Pollan <meskio@sindominio.net>
Diffstat (limited to 'src/leap/bitmask/bonafide/session.py')
-rw-r--r-- | src/leap/bitmask/bonafide/session.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/leap/bitmask/bonafide/session.py b/src/leap/bitmask/bonafide/session.py index 5a743e94..732afe53 100644 --- a/src/leap/bitmask/bonafide/session.py +++ b/src/leap/bitmask/bonafide/session.py @@ -69,6 +69,7 @@ class Session(object): self._srp_auth = _srp.SRPAuthMechanism(username, password) self._srp_signup = _srp.SRPSignupMechanism() self._srp_password = _srp.SRPPasswordChangeMechanism() + self._srp_recovery_code = _srp.SRPRecoveryCodeUpdateMechanism() self._token = None self._uuid = None @@ -139,6 +140,17 @@ class Session(object): self._srp_auth = _srp.SRPAuthMechanism(self.username, password) defer.returnValue(OK) + @_auth_required + @defer.inlineCallbacks + def update_recovery_code(self, recovery_code): + uri = self._api.get_update_user_uri(uid=self._uuid) + met = self._api.get_update_user_method() + params = self._srp_recovery_code.get_recovery_code_params( + self.username, recovery_code) + update = yield self._request(self._agent, uri, values=params, + method=met) + defer.returnValue(update) + # User certificates def get_vpn_cert(self): |