mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-18 14:16:45 +00:00
Make webfinger match usernames in case insensitive manner
This commit is contained in:
parent
691f9c01c4
commit
92b96afc2d
2 changed files with 11 additions and 1 deletions
|
@ -51,6 +51,16 @@ class UserViews(TestCase):
|
||||||
data = json.loads(result.getvalue())
|
data = json.loads(result.getvalue())
|
||||||
self.assertEqual(data["subject"], "acct:mouse@local.com")
|
self.assertEqual(data["subject"], "acct:mouse@local.com")
|
||||||
|
|
||||||
|
def test_webfinger_case_sensitivty(self):
|
||||||
|
"""ensure that webfinger queries are not case sensitive"""
|
||||||
|
request = self.factory.get("", {"resource": "acct:MoUsE@local.com"})
|
||||||
|
request.user = self.anonymous_user
|
||||||
|
|
||||||
|
result = views.webfinger(request)
|
||||||
|
self.assertIsInstance(result, JsonResponse)
|
||||||
|
data = json.loads(result.getvalue())
|
||||||
|
self.assertEqual(data["subject"], "acct:mouse@local.com")
|
||||||
|
|
||||||
def test_nodeinfo_pointer(self):
|
def test_nodeinfo_pointer(self):
|
||||||
"""just tells you where nodeinfo is"""
|
"""just tells you where nodeinfo is"""
|
||||||
request = self.factory.get("")
|
request = self.factory.get("")
|
||||||
|
|
|
@ -20,7 +20,7 @@ def webfinger(request):
|
||||||
|
|
||||||
username = resource.replace("acct:", "")
|
username = resource.replace("acct:", "")
|
||||||
try:
|
try:
|
||||||
user = models.User.objects.get(username=username)
|
user = models.User.objects.get(username__iexact=username)
|
||||||
except models.User.DoesNotExist:
|
except models.User.DoesNotExist:
|
||||||
return HttpResponseNotFound("No account found")
|
return HttpResponseNotFound("No account found")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue