|
26 | 26 | SynapseError, |
27 | 27 | ) |
28 | 28 | from synapse.api.ratelimiting import Ratelimiter |
29 | | -from synapse.config.emailconfig import ThreepidBehaviour |
30 | 29 | from synapse.http import RequestTimedOutError |
31 | 30 | from synapse.http.client import SimpleHttpClient |
32 | 31 | from synapse.http.site import SynapseRequest |
@@ -416,48 +415,6 @@ async def send_threepid_validation( |
416 | 415 |
|
417 | 416 | return session_id |
418 | 417 |
|
419 | | - async def request_email_token( |
420 | | - self, |
421 | | - id_server: str, |
422 | | - email: str, |
423 | | - client_secret: str, |
424 | | - send_attempt: int, |
425 | | - next_link: Optional[str] = None, |
426 | | - ) -> JsonDict: |
427 | | - """ |
428 | | - Request an external server send an email on our behalf for the purposes of threepid |
429 | | - validation. |
430 | | -
|
431 | | - Args: |
432 | | - id_server: The identity server to proxy to |
433 | | - email: The email to send the message to |
434 | | - client_secret: The unique client_secret sends by the user |
435 | | - send_attempt: Which attempt this is |
436 | | - next_link: A link to redirect the user to once they submit the token |
437 | | -
|
438 | | - Returns: |
439 | | - The json response body from the server |
440 | | - """ |
441 | | - params = { |
442 | | - "email": email, |
443 | | - "client_secret": client_secret, |
444 | | - "send_attempt": send_attempt, |
445 | | - } |
446 | | - if next_link: |
447 | | - params["next_link"] = next_link |
448 | | - |
449 | | - try: |
450 | | - data = await self.http_client.post_json_get_json( |
451 | | - id_server + "/_matrix/identity/api/v1/validate/email/requestToken", |
452 | | - params, |
453 | | - ) |
454 | | - return data |
455 | | - except HttpResponseException as e: |
456 | | - logger.info("Proxied requestToken failed: %r", e) |
457 | | - raise e.to_synapse_error() |
458 | | - except RequestTimedOutError: |
459 | | - raise SynapseError(500, "Timed out contacting identity server") |
460 | | - |
461 | 418 | async def requestMsisdnToken( |
462 | 419 | self, |
463 | 420 | id_server: str, |
@@ -531,18 +488,7 @@ async def validate_threepid_session( |
531 | 488 | validation_session = None |
532 | 489 |
|
533 | 490 | # Try to validate as email |
534 | | - if self.hs.config.email.threepid_behaviour_email == ThreepidBehaviour.REMOTE: |
535 | | - # Remote emails will only be used if a valid identity server is provided. |
536 | | - assert ( |
537 | | - self.hs.config.registration.account_threepid_delegate_email is not None |
538 | | - ) |
539 | | - |
540 | | - # Ask our delegated email identity server |
541 | | - validation_session = await self.threepid_from_creds( |
542 | | - self.hs.config.registration.account_threepid_delegate_email, |
543 | | - threepid_creds, |
544 | | - ) |
545 | | - elif self.hs.config.email.threepid_behaviour_email == ThreepidBehaviour.LOCAL: |
| 491 | + if self.hs.config.email.can_verify_email: |
546 | 492 | # Get a validated session matching these details |
547 | 493 | validation_session = await self.store.get_threepid_validation_session( |
548 | 494 | "email", client_secret, sid=sid, validated=True |
|
0 commit comments