From 2fc85ad7d109ca4304d1fb1515b7087a1bb2ae3e Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Tue, 27 Sep 2016 19:28:28 -0500 Subject: [feature]Add change password command - Resolves: #8487 --- src/leap/bitmask/bonafide/session.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/leap/bitmask/bonafide/session.py') diff --git a/src/leap/bitmask/bonafide/session.py b/src/leap/bitmask/bonafide/session.py index f25fa05..abb697a 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): -- cgit v1.2.3