summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/bonafide/_protocol.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2016-09-27 19:28:28 -0500
committerRuben Pollan <meskio@sindominio.net>2016-09-28 17:23:37 -0500
commit2fc85ad7d109ca4304d1fb1515b7087a1bb2ae3e (patch)
treef3627d5b9fd613dad05aa416df7d445fde02e0ae /src/leap/bitmask/bonafide/_protocol.py
parent1aa1ffde9613435fe95434ead4909ea081d0c3c9 (diff)
[feature]Add change password command
- Resolves: #8487
Diffstat (limited to 'src/leap/bitmask/bonafide/_protocol.py')
-rw-r--r--src/leap/bitmask/bonafide/_protocol.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/leap/bitmask/bonafide/_protocol.py b/src/leap/bitmask/bonafide/_protocol.py
index ff357a1..7917f38 100644
--- a/src/leap/bitmask/bonafide/_protocol.py
+++ b/src/leap/bitmask/bonafide/_protocol.py
@@ -147,6 +147,18 @@ class BonafideProtocol(object):
d.addCallback(lambda _: '%s logged out' % full_id)
return d
+ def do_change_password(self, full_id, current_password, new_password):
+ log.msg('Change password for %s' % full_id)
+ if (full_id not in self._sessions or
+ not self._sessions[full_id].is_authenticated):
+ return fail(RuntimeError("There is no session for such user"))
+ session = self._sessions[full_id]
+
+ if current_password != session.password:
+ return fail(RuntimeError("The current password is not valid"))
+
+ return session.change_password(new_password)
+
def do_get_provider(self, provider_id, autoconf=False):
provider = config.Provider(provider_id, autoconf=autoconf)
return provider.callWhenMainConfigReady(provider.config)