diff options
author | Ruben Pollan <meskio@sindominio.net> | 2016-09-27 19:28:28 -0500 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2016-09-28 17:23:37 -0500 |
commit | 2fc85ad7d109ca4304d1fb1515b7087a1bb2ae3e (patch) | |
tree | f3627d5b9fd613dad05aa416df7d445fde02e0ae /src/leap/bitmask/bonafide/session.py | |
parent | 1aa1ffde9613435fe95434ead4909ea081d0c3c9 (diff) |
[feature]Add change password command
- Resolves: #8487
Diffstat (limited to 'src/leap/bitmask/bonafide/session.py')
-rw-r--r-- | src/leap/bitmask/bonafide/session.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/bitmask/bonafide/session.py b/src/leap/bitmask/bonafide/session.py index f25fa05e..abb697ac 100644 --- a/src/leap/bitmask/bonafide/session.py +++ b/src/leap/bitmask/bonafide/session.py @@ -66,6 +66,7 @@ class Session(object): password = self.password or '' self._srp_auth = _srp.SRPAuthMechanism(username, password) self._srp_signup = _srp.SRPSignupMechanism() + self._srp_password = _srp.SRPPasswordChangeMechanism() self._token = None self._uuid = None @@ -123,6 +124,19 @@ class Session(object): self._initialize_session() defer.returnValue(OK) + @_auth_required + @defer.inlineCallbacks + def change_password(self, password): + uri = self._api.get_update_user_uri(uid=self._uuid) + met = self._api.get_update_user_method() + params = self._srp_password.get_password_params( + self.username, password) + update = yield self._request(self._agent, uri, values=params, + method=met) + self.password = password + self._srp_auth = _srp.SRPAuthMechanism(self.username, password) + defer.returnValue(OK) + # User certificates def get_vpn_cert(self): |