mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 20:12:15 -04:00
Limit length of accepted email addresses (#9855)
This commit is contained in:
parent
69018acbd2
commit
177dae2704
6 changed files with 100 additions and 7 deletions
|
@ -39,7 +39,7 @@ from synapse.metrics import threepid_send_requests
|
|||
from synapse.push.mailer import Mailer
|
||||
from synapse.util.msisdn import phone_number_to_msisdn
|
||||
from synapse.util.stringutils import assert_valid_client_secret, random_string
|
||||
from synapse.util.threepids import canonicalise_email, check_3pid_allowed
|
||||
from synapse.util.threepids import check_3pid_allowed, validate_email
|
||||
|
||||
from ._base import client_patterns, interactive_auth_handler
|
||||
|
||||
|
@ -92,7 +92,7 @@ class EmailPasswordRequestTokenRestServlet(RestServlet):
|
|||
# Stored in the database "foo@bar.com"
|
||||
# User requests with "FOO@bar.com" would raise a Not Found error
|
||||
try:
|
||||
email = canonicalise_email(body["email"])
|
||||
email = validate_email(body["email"])
|
||||
except ValueError as e:
|
||||
raise SynapseError(400, str(e))
|
||||
send_attempt = body["send_attempt"]
|
||||
|
@ -247,7 +247,7 @@ class PasswordRestServlet(RestServlet):
|
|||
# We store all email addresses canonicalised in the DB.
|
||||
# (See add_threepid in synapse/handlers/auth.py)
|
||||
try:
|
||||
threepid["address"] = canonicalise_email(threepid["address"])
|
||||
threepid["address"] = validate_email(threepid["address"])
|
||||
except ValueError as e:
|
||||
raise SynapseError(400, str(e))
|
||||
# if using email, we must know about the email they're authing with!
|
||||
|
@ -375,7 +375,7 @@ class EmailThreepidRequestTokenRestServlet(RestServlet):
|
|||
# Otherwise the email will be sent to "FOO@bar.com" and stored as
|
||||
# "foo@bar.com" in database.
|
||||
try:
|
||||
email = canonicalise_email(body["email"])
|
||||
email = validate_email(body["email"])
|
||||
except ValueError as e:
|
||||
raise SynapseError(400, str(e))
|
||||
send_attempt = body["send_attempt"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue