1๐
I think at the root all you have to do is create your own authentiaction backened, and register it.
class YourBackend(object)
def authenticate(self, username=None, your_other_field=None):
# get user based on username AND other field
return user instance or None
Then all you have to do is register in AUTHENTICATION_BACKEND
. Remember:
The order of AUTHENTICATION_BACKENDS matters, so if the same username
and password is valid in multiple backends, Django will stop
processing at the first positive match.
๐คdm03514
Source:stackexchange.com