summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--users/models/domain.py5
-rw-r--r--users/models/identity.py5
2 files changed, 6 insertions, 4 deletions
diff --git a/users/models/domain.py b/users/models/domain.py
index c238025..40a3e22 100644
--- a/users/models/domain.py
+++ b/users/models/domain.py
@@ -59,13 +59,14 @@ class Domain(models.Model):
@classmethod
def get_remote_domain(cls, domain: str) -> "Domain":
- return cls.objects.get_or_create(domain=domain, local=False)[0]
+ return cls.objects.get_or_create(domain=domain.lower(), local=False)[0]
@classmethod
def get_domain(cls, domain: str) -> Optional["Domain"]:
try:
return cls.objects.get(
- models.Q(domain=domain) | models.Q(service_domain=domain)
+ models.Q(domain=domain.lower())
+ | models.Q(service_domain=domain.lower())
)
except cls.DoesNotExist:
return None
diff --git a/users/models/identity.py b/users/models/identity.py
index cfa8c2c..7730c8f 100644
--- a/users/models/identity.py
+++ b/users/models/identity.py
@@ -153,6 +153,7 @@ class Identity(StatorModel):
if username.startswith("@"):
raise ValueError("Username must not start with @")
username = username.lower()
+ domain = domain.lower()
try:
if local:
return cls.objects.get(username=username, domain_id=domain, local=True)
@@ -300,7 +301,7 @@ class Identity(StatorModel):
Given a username@domain handle, returns a tuple of
(actor uri, canonical handle) or None, None if it does not resolve.
"""
- domain = handle.split("@")[1]
+ domain = handle.split("@")[1].lower()
try:
response = await SystemActor().signed_request(
method="get",
@@ -381,7 +382,7 @@ class Identity(StatorModel):
)
if webfinger_handle:
webfinger_username, webfinger_domain = webfinger_handle.split("@")
- self.username = webfinger_username
+ self.username = webfinger_username.lower()
self.domain = await get_domain(webfinger_domain)
else:
self.domain = await get_domain(actor_url_parts.hostname)