Sunday, December 25, 2022

Re: Location identification with login

Yes, that is certainly possible, although there is nothing built into Django itself.

Web servers (and proxies) both pass the IP address of the remote user, which can be recorded at login together with reference to the account. Using GeoIP you can associate this more or less reliably to a location, or at least a country.  Check out the django-geoip module on pipit.org to start (and there are others)

The general approach to tracking website visitiors uses this technique and is quite a useful metric. WRT logins it can be even more useful to track where a user signed up and where they typically log in from. This can trigger, e.g. email verification when a user logs in from an unexpected address.

Blacklisting by source IP though, I would argue is the job more suited to a reverse proxy, tcpwrappers or a firewall like Linux iptables.


Regards,
David

------ Original Message ------
From "tristant" <tran.trong.tri@gmail.com>
To "Django users" <django-users@googlegroups.com>
Date 12/26/2022 6:52:13 AM
Subject Location identification with login

Is there a mechanism in Django where we can identify the location of login? Any reading sources regarding this functionality would be much appreciated.

Along the same line, is there a way to prevent a login attempt if the location is within certain blacklisted IP subnets?

Thanks,

No comments:

Post a Comment