from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import authenticate


class LoginForm(AuthenticationForm):

    email = forms.EmailField()
    password = forms.CharField(widget=forms.PasswordInput)

    def __init__(self, *args, **kwargs):
        self.organization = kwargs.pop('organization')
        super(LoginForm, self).__init__(*args, **kwargs)

    def clean(self):
        username = self.cleaned_data.get('username')
        password = self.cleaned_data.get('password')

        if username and password:
            self.user_cache = authenticate(
                username=username,
                password=password,
                organization=self.organization
            )
            if self.user_cache is None:
                raise forms.ValidationError(
                    self.error_messages['invalid_login'],
                    code='invalid_login',
                    params={'username': 'email'},
                )
            else:
                self.confirm_login_allowed(self.user_cache)

        return self.cleaned_data


class InviteForm(forms.ModelForm):

    class Meta:
        model = User
        fields = ['email', 'login', 'full_name']

@@ -46,22 +46,16 @@
 auth
-.forms
  import 
 Auth
@@ -50,17 +50,17 @@
  import 
-A
+a
 uthentic
@@ -61,23 +61,17 @@
 henticat
-ionForm
+e
 %0Afrom dj
@@ -83,32 +83,38 @@
 contrib.auth
+.forms
  import 
 authenticate
@@ -93,33 +93,33 @@
 th.forms import 
-a
+A
 uthenticate%0A%0A%0Acl
@@ -112,17 +112,49 @@
 henticat
-e
+ionForm%0A%0Afrom .models import User
 %0A%0A%0Aclass

Add import of user model in accounts forms