Force username to lowercase for now
This commit is contained in:
parent
716d8a766a
commit
7f8e792402
|
@ -134,6 +134,7 @@ class Identity(StatorModel):
|
||||||
def by_username_and_domain(cls, username, domain, fetch=False, local=False):
|
def by_username_and_domain(cls, username, domain, fetch=False, local=False):
|
||||||
if username.startswith("@"):
|
if username.startswith("@"):
|
||||||
raise ValueError("Username must not start with @")
|
raise ValueError("Username must not start with @")
|
||||||
|
username = username.lower()
|
||||||
try:
|
try:
|
||||||
if local:
|
if local:
|
||||||
return cls.objects.get(username=username, domain_id=domain, local=True)
|
return cls.objects.get(username=username, domain_id=domain, local=True)
|
||||||
|
@ -281,6 +282,8 @@ class Identity(StatorModel):
|
||||||
self.username = document.get("preferredUsername")
|
self.username = document.get("preferredUsername")
|
||||||
if self.username and "@value" in self.username:
|
if self.username and "@value" in self.username:
|
||||||
self.username = self.username["@value"]
|
self.username = self.username["@value"]
|
||||||
|
if self.username:
|
||||||
|
self.username = self.username.lower()
|
||||||
self.manually_approves_followers = document.get(
|
self.manually_approves_followers = document.get(
|
||||||
"as:manuallyApprovesFollowers"
|
"as:manuallyApprovesFollowers"
|
||||||
)
|
)
|
||||||
|
|
|
@ -147,7 +147,7 @@ class CreateIdentity(FormView):
|
||||||
domain_instance = Domain.get_domain(domain)
|
domain_instance = Domain.get_domain(domain)
|
||||||
new_identity = Identity.objects.create(
|
new_identity = Identity.objects.create(
|
||||||
actor_uri=f"https://{domain_instance.uri_domain}/@{username}@{domain}/actor/",
|
actor_uri=f"https://{domain_instance.uri_domain}/@{username}@{domain}/actor/",
|
||||||
username=username,
|
username=username.lower(),
|
||||||
domain_id=domain,
|
domain_id=domain,
|
||||||
name=form.cleaned_data["name"],
|
name=form.cleaned_data["name"],
|
||||||
local=True,
|
local=True,
|
||||||
|
|
Loading…
Reference in New Issue