Support multiple addresses for IP-based connection (useful when using IPv4/IPv6 and for ENS -> Crans transition)

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-09-08 14:52:39 +02:00
parent 048266ed61
commit d965732b65
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 1 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class LoginByIPMiddleware(object):
else:
ip = request.META.get('REMOTE_ADDR')
qs = User.objects.filter(password=f"ipbased${ip}")
qs = User.objects.filter(password__iregex=f"ipbased\\$.*\\^{ip}\\$.*")
if qs.exists():
login(request, qs.get())
session = request.session