summary refs log tree commit diff
path: root/synapse/rest/client/v1/register.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-07-04 14:23:04 +0100
committerGitHub <noreply@github.com>2016-07-04 14:23:04 +0100
commit3de816834379664f7bc3dbf595a5187b5c0b8a51 (patch)
tree1f2556704b4e3157208f44f9a70c66581b43ec73 /synapse/rest/client/v1/register.py
parentcode_style.rst: add link to sphinx examples (diff)
parentFix style violations (diff)
downloadsynapse-3de816834379664f7bc3dbf595a5187b5c0b8a51.tar.xz
Merge pull request #905 from KentShikama/add-password-hash
Optionally include password hash in createUser endpoint
Diffstat (limited to 'synapse/rest/client/v1/register.py')
-rw-r--r--synapse/rest/client/v1/register.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/register.py b/synapse/rest/client/v1/register.py
index e3f4fbb0bb..d791d5e07e 100644
--- a/synapse/rest/client/v1/register.py
+++ b/synapse/rest/client/v1/register.py
@@ -410,12 +410,15 @@ class CreateUserRestServlet(ClientV1RestServlet):
             raise SynapseError(400, "Failed to parse 'duration_seconds'")
         if duration_seconds > self.direct_user_creation_max_duration:
             duration_seconds = self.direct_user_creation_max_duration
+        password_hash = user_json["password_hash"].encode("utf-8") \
+            if user_json.get("password_hash") else None
 
         handler = self.handlers.registration_handler
         user_id, token = yield handler.get_or_create_user(
             localpart=localpart,
             displayname=displayname,
-            duration_seconds=duration_seconds
+            duration_seconds=duration_seconds,
+            password_hash=password_hash
         )
 
         defer.returnValue({