from django import forms
import django.contrib.auth.forms
-from django.contrib.auth import authenticate
-
-from panikdb.aa.models import User
+from django.contrib.auth import authenticate, get_user_model
class AuthenticationForm(django.contrib.auth.forms.AuthenticationForm):
if username and password:
user = None
if '@' in username:
- user = User.objects.filter(email=username).first()
+ user = get_user_model().objects.filter(email=username).first()
if user:
self.user_cache = authenticate(username=user.username, password=password)
else: