summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/auth_blocking.py20
-rw-r--r--synapse/api/constants.py2
-rw-r--r--synapse/api/errors.py13
3 files changed, 3 insertions, 32 deletions
diff --git a/synapse/api/auth_blocking.py b/synapse/api/auth_blocking.py

index 303c9ba03e..a56ffd58e4 100644 --- a/synapse/api/auth_blocking.py +++ b/synapse/api/auth_blocking.py
@@ -24,7 +24,6 @@ from typing import TYPE_CHECKING, Optional from synapse.api.constants import LimitBlockingTypes, UserTypes from synapse.api.errors import Codes, ResourceLimitError -from synapse.config.server import is_threepid_reserved from synapse.types import Requester if TYPE_CHECKING: @@ -43,16 +42,13 @@ class AuthBlocking: self._admin_contact = hs.config.server.admin_contact self._max_mau_value = hs.config.server.max_mau_value self._limit_usage_by_mau = hs.config.server.limit_usage_by_mau - self._mau_limits_reserved_threepids = ( - hs.config.server.mau_limits_reserved_threepids - ) self._is_mine_server_name = hs.is_mine_server_name self._track_appservice_user_ips = hs.config.appservice.track_appservice_user_ips async def check_auth_blocking( self, user_id: Optional[str] = None, - threepid: Optional[dict] = None, + threepid: Optional[str] = None, # Not used in this method, but kept for compatibility user_type: Optional[str] = None, requester: Optional[Requester] = None, ) -> None: @@ -63,12 +59,6 @@ class AuthBlocking: user_id: If present, checks for presence against existing MAU cohort - threepid: If present, checks for presence against configured - reserved threepid. Used in cases where the user is trying register - with a MAU blocked server, normally they would be rejected but their - threepid is on the reserved list. user_id and - threepid should never be set at the same time. - user_type: If present, is used to decide whether to check against certain blocking reasons like MAU. @@ -111,9 +101,8 @@ class AuthBlocking: admin_contact=self._admin_contact, limit_type=LimitBlockingTypes.HS_DISABLED, ) - if self._limit_usage_by_mau is True: - assert not (user_id and threepid) + if self._limit_usage_by_mau is True: # If the user is already part of the MAU cohort or a trial user if user_id: timestamp = await self.store.user_last_seen_monthly_active(user_id) @@ -123,11 +112,6 @@ class AuthBlocking: is_trial = await self.store.is_trial_user(user_id) if is_trial: return - elif threepid: - # If the user does not exist yet, but is signing up with a - # reserved threepid then pass auth check - if is_threepid_reserved(self._mau_limits_reserved_threepids, threepid): - return elif user_type == UserTypes.SUPPORT: # If the user does not exist yet and is of type "support", # allow registration. Support users are excluded from MAU checks. diff --git a/synapse/api/constants.py b/synapse/api/constants.py
index e36461486b..cd2ebf2cc3 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py
@@ -86,8 +86,6 @@ class RestrictedJoinRuleTypes: class LoginType: PASSWORD: Final = "m.login.password" - EMAIL_IDENTITY: Final = "m.login.email.identity" - MSISDN: Final = "m.login.msisdn" RECAPTCHA: Final = "m.login.recaptcha" TERMS: Final = "m.login.terms" SSO: Final = "m.login.sso" diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 3eb533f7d5..a095fb195b 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py
@@ -65,12 +65,8 @@ class Codes(str, Enum): INVALID_PARAM = "M_INVALID_PARAM" TOO_LARGE = "M_TOO_LARGE" EXCLUSIVE = "M_EXCLUSIVE" - THREEPID_AUTH_FAILED = "M_THREEPID_AUTH_FAILED" - THREEPID_IN_USE = "M_THREEPID_IN_USE" - THREEPID_NOT_FOUND = "M_THREEPID_NOT_FOUND" - THREEPID_DENIED = "M_THREEPID_DENIED" INVALID_USERNAME = "M_INVALID_USERNAME" - THREEPID_MEDIUM_NOT_SUPPORTED = "M_THREEPID_MEDIUM_NOT_SUPPORTED" + THREEPID_MEDIUM_NOT_SUPPORTED = "M_THREEPID_MEDIUM_NOT_SUPPORTED" # Kept around for throwing when 3PID is attempted SERVER_NOT_TRUSTED = "M_SERVER_NOT_TRUSTED" CONSENT_NOT_GIVEN = "M_CONSENT_NOT_GIVEN" CANNOT_LEAVE_SERVER_NOTICE_ROOM = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM" @@ -581,13 +577,6 @@ class UnsupportedRoomVersionError(SynapseError): ) -class ThreepidValidationError(SynapseError): - """An error raised when there was a problem authorising an event.""" - - def __init__(self, msg: str, errcode: str = Codes.FORBIDDEN): - super().__init__(400, msg, errcode) - - class IncompatibleRoomVersionError(SynapseError): """A server is trying to join a room whose version it does not support.