title: My view to login keeps saying that "User with this Email already exists."
body: <p>I have a customized User model</p>
  
  <pre><code>class User(AbstractBaseUser):
     email       = _models.EmailField     (max_length=252, unique=True)
     username    = _models.CharField      (max_length=252, blank=True, null=True)
     staff       = _models.BooleanField   (default=False)
     superuser   = _models.BooleanField   (default=False)
     active      = _models.BooleanField   (default=True)
  
     USERNAME_FIELD = 'email'
  </code></pre>
  
  <p>This is the form</p>
  
  <pre><code>class UserLoginForm(_f.ModelForm):
      password = _f.CharField(widget=_f.PasswordInput())
  
      class Meta:
          model = User
          fields = ['email', 'password']
  </code></pre>
  
  <p>And this is the view</p>
  
  <pre><code>from django.contrib.auth import authenticate, login
  from django.views.generic import FormView,
  from .forms import UserRegistrationForm, UserLoginForm
  class UserLoginView(FormView):
      form_class = UserLoginForm
      success_url = '/'
      template_name = 'accounts/user_login.html'
  
      def form_valid(self, form):
          email = form.cleaned_data.get('email')
          password = form.cleaned_data.get('password')
          user = authenticate(request=self.request, email=email, password=password)
  
          if user:
              login(self.request, user)
              return super(UserLoginView, self).form_valid(form)
  
          return super(UserLoginView, self).form_invalid(form)
  </code></pre>
  
  <p>the <code>urls.py</code> of the app</p>
  
  <pre><code>from django.urls import path
  from .views import UserLoginView, UserRegistrationView
  app_name = 'accounts'
  urlpatterns = [
      path('login/', UserLoginView.as_view(), name='login'),
      path('register/', UserRegistrationView.as_view(), name='register'),
  ]
  </code></pre>
  
  <p>the <code>urls.py</code> of the project</p>
  
  <pre><code>urlpatterns = [
      path('admin/', admin.site.urls),
      path('', include('applications.accounts.urls', namespace='namespace_accounts')),
  ]
  </code></pre>
  
  <p>This the template <code>user_login.html</code> of the view <code>UserLoginView</code></p>
  
  <pre><code>{% extends 'accounts/login_base.html' %}
  {% load staticfiles %}
  
  {% block content %}
  &lt;form method="POST"&gt;
      &lt;div class="form-group"&gt;
          {% csrf_token %}
          {{ form.as_p }}
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-dark"&gt;Login&lt;/button&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>After registrating as new user, the user is redirected to the login page, with the credentials, the login keeps saying "User with this Email already exists."</p>
  
  <p>Note: The <code>email</code> field on the model <code>User</code> is unique.</p>
  
  <p>Is obvious that the login page is trying to make another registration somehow, and this "somehow" is what it's confusing me.</p>
  
  <p>What could I possibly be doing to solve this "User with this Email already exists."? </p>