mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-27 07:59:23 -05:00
Fix registration
This commit is contained in:
parent
d45f28f8bd
commit
a295a3c691
@ -22,6 +22,7 @@ from synapse.api.errors import (
|
|||||||
)
|
)
|
||||||
from ._base import BaseHandler
|
from ._base import BaseHandler
|
||||||
import synapse.util.stringutils as stringutils
|
import synapse.util.stringutils as stringutils
|
||||||
|
from synapse.util.async import run_on_reactor
|
||||||
from synapse.http.client import SimpleHttpClient
|
from synapse.http.client import SimpleHttpClient
|
||||||
from synapse.http.client import CaptchaServerHttpClient
|
from synapse.http.client import CaptchaServerHttpClient
|
||||||
|
|
||||||
@ -54,12 +55,13 @@ class RegistrationHandler(BaseHandler):
|
|||||||
Raises:
|
Raises:
|
||||||
RegistrationError if there was a problem registering.
|
RegistrationError if there was a problem registering.
|
||||||
"""
|
"""
|
||||||
|
yield run_on_reactor()
|
||||||
password_hash = None
|
password_hash = None
|
||||||
if password:
|
if password:
|
||||||
password_hash = bcrypt.hashpw(password, bcrypt.gensalt())
|
password_hash = bcrypt.hashpw(password, bcrypt.gensalt())
|
||||||
|
|
||||||
if localpart:
|
if localpart:
|
||||||
user = UserID(localpart, self.hs.hostname, True)
|
user = UserID(localpart, self.hs.hostname)
|
||||||
user_id = user.to_string()
|
user_id = user.to_string()
|
||||||
|
|
||||||
token = self._generate_token(user_id)
|
token = self._generate_token(user_id)
|
||||||
@ -78,7 +80,7 @@ class RegistrationHandler(BaseHandler):
|
|||||||
while not user_id and not token:
|
while not user_id and not token:
|
||||||
try:
|
try:
|
||||||
localpart = self._generate_user_id()
|
localpart = self._generate_user_id()
|
||||||
user = UserID(localpart, self.hs.hostname, True)
|
user = UserID(localpart, self.hs.hostname)
|
||||||
user_id = user.to_string()
|
user_id = user.to_string()
|
||||||
|
|
||||||
token = self._generate_token(user_id)
|
token = self._generate_token(user_id)
|
||||||
|
@ -21,6 +21,8 @@ from synapse.api.constants import LoginType
|
|||||||
from base import RestServlet, client_path_pattern
|
from base import RestServlet, client_path_pattern
|
||||||
import synapse.util.stringutils as stringutils
|
import synapse.util.stringutils as stringutils
|
||||||
|
|
||||||
|
from synapse.util.async import run_on_reactor
|
||||||
|
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
import hmac
|
import hmac
|
||||||
import json
|
import json
|
||||||
@ -233,7 +235,7 @@ class RegisterRestServlet(RestServlet):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _do_password(self, request, register_json, session):
|
def _do_password(self, request, register_json, session):
|
||||||
yield
|
yield run_on_reactor()
|
||||||
if (self.hs.config.enable_registration_captcha and
|
if (self.hs.config.enable_registration_captcha and
|
||||||
not session[LoginType.RECAPTCHA]):
|
not session[LoginType.RECAPTCHA]):
|
||||||
# captcha should've been done by this stage!
|
# captcha should've been done by this stage!
|
||||||
|
Loading…
Reference in New Issue
Block a user