0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-15 17:18:19 +02:00

Revert "Add "require_consent" parameter for registration"

This reverts commit 3320aaab3a.
This commit is contained in:
Brendan Abolivier 2019-08-22 14:47:34 +01:00
parent 27a686e53b
commit 1c5b8c6222
3 changed files with 3 additions and 18 deletions

View file

@ -150,7 +150,6 @@ class RegistrationHandler(BaseHandler):
threepid=None,
user_type=None,
default_display_name=None,
require_consent=True,
address=None,
bind_emails=[],
):
@ -168,7 +167,6 @@ class RegistrationHandler(BaseHandler):
will be set to this. Defaults to 'localpart'.
address (str|None): the IP address used to perform the registration.
bind_emails (List[str]): list of emails to bind to this account.
require_consent (bool): Should the user be required to give consent.
Returns:
Deferred[str]: user_id
Raises:
@ -213,7 +211,6 @@ class RegistrationHandler(BaseHandler):
admin=admin,
user_type=user_type,
address=address,
require_consent=require_consent,
)
if self.hs.config.user_directory_search_all_users:
@ -247,7 +244,7 @@ class RegistrationHandler(BaseHandler):
user_id = None
attempts += 1
if not self.hs.config.user_consent_at_registration and require_consent:
if not self.hs.config.user_consent_at_registration:
yield self._auto_join_rooms(user_id)
else:
logger.info(
@ -528,7 +525,6 @@ class RegistrationHandler(BaseHandler):
ratelimit=False,
)
@defer.inlineCallbacks
def register_with_store(
self,
user_id,
@ -540,7 +536,6 @@ class RegistrationHandler(BaseHandler):
admin=False,
user_type=None,
address=None,
require_consent=True,
):
"""Register user in the datastore.
@ -558,7 +553,7 @@ class RegistrationHandler(BaseHandler):
user_type (str|None): type of user. One of the values from
api.constants.UserTypes, or None for a normal user.
address (str|None): the IP address used to perform the registration.
require_consent (bool): Should the user be required to give consent.
Returns:
Deferred
"""
@ -589,12 +584,8 @@ class RegistrationHandler(BaseHandler):
admin=admin,
user_type=user_type,
address=address,
require_consent=require_consent,
)
else:
if require_consent is False:
yield self.store.user_set_consent_version(user_id, "no-consent-required")
return self.store.register_user(
user_id=user_id,
password_hash=password_hash,
@ -606,7 +597,6 @@ class RegistrationHandler(BaseHandler):
user_type=user_type,
)
@defer.inlineCallbacks
def register_device(self, user_id, device_id, initial_display_name, is_guest=False):
"""Register a device for a user and generate an access token.

View file

@ -72,7 +72,6 @@ class ReplicationRegisterServlet(ReplicationEndpoint):
"admin": admin,
"user_type": user_type,
"address": address,
"require_consent": require_consent,
}
@defer.inlineCallbacks
@ -89,7 +88,6 @@ class ReplicationRegisterServlet(ReplicationEndpoint):
admin=content["admin"],
user_type=content["user_type"],
address=content["address"],
require_consent=content["require_consent"],
)
return (200, {})

View file

@ -525,9 +525,6 @@ class RegisterRestServlet(RestServlet):
# downcased one in `username` for the mac calculation
user = body["username"].encode("utf-8")
# do not require consent for this user (for example, bots)
require_consent = body.get("require_consent", True)
# str() because otherwise hmac complains that 'unicode' does not
# have the buffer interface
got_mac = str(body["mac"])
@ -545,7 +542,7 @@ class RegisterRestServlet(RestServlet):
raise SynapseError(403, "HMAC incorrect")
user_id = yield self.registration_handler.register_user(
localpart=username, password=password, require_consent=require_consent,
localpart=username, password=password
)
result = yield self._create_registration_details(user_id, body)