Login has no errors, with Code 200

Login don’t work and don’t give any errors in Terminal and in html also, but it gives this 200 Code in terminal

Logic i want to achieve is :

  • Using HTML form.
  • Customize LoginView to change template_name and class_form.
  • Customize AuthenticationForm to pass to LoginView form_class
    Any Clue i Can follow.

Thank You For Support In Advance.

[15/Jun/2022 16:04:44] "POST /users/sign-in HTTP/1.1" 200 10891

HTML:

<form class="ui form" method="POST" novalidate>
    {% csrf_token %}
    <div class="field">
        <label for="email">{{ form.email.label }}</label>
        <div class="ui left icon input">
            {{ form.email }}
            <i class="mail icon"></i>
        </div>
    </div>
    <div class="field">
        <label for="password">{{ form.password.label }}</label>
        <div class="ui left icon input">
            {{ form.password }}
            <i class="key icon"></i>
        </div>
    </div>
    {% if form.non_field_errors %}
    {% for error in form.non_field_errors %}
    <div class="ui negative message">
        <i class="close icon"></i>
        <p>{{ error }}</p>
    </div>
    {% endfor %}
    {% endif %}
    <button class="ui green large fluid button" type="submit">Sign In</button>
</form>

Url:

path('sign-in', views.ClientSignInView.as_view(), name='ClientSignInUrl'),

Views:

class ClientSignInView(LoginView):
    template_name = 'Users/Sign_In.html'
    authentication_form = ClientSignInForm
    success_url = 'Pages:HomeView'

    def get_context_data(self, **kwargs):
        context = super(ClientSignInView, self).get_context_data(**kwargs)
        context['page'] = 'Sign In'
        return context

Forms:

class ClientSignInForm(AuthenticationForm):
    def __init__(self, *args, **kwargs):
        super(ClientSignInForm, self).__init__(*args, **kwargs)

    email = forms.EmailField(
        widget=forms.EmailInput(attrs={'placeholder': 'E-Mail ...', 'name': 'email', 'id': 'email'}),
        label='E-Mail Address')
    password = forms.CharField(
        widget=forms.PasswordInput(attrs={'placeholder': 'Password ...', 'name': 'password', 'id': 'password'}),
        label='Password')

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

The AuthenticationForm is not a model form - those form fields are not associated with a model.

The authentication being performed on the input from that form is done on a field named username, not email. That’s the name you would need to use for your field. (Remember, this is not a reference to a model, it’s just the name of the field in the form.)

Likewise, since this is a Form and not a ModelForm, your Meta class isn’t doing anything. It’s not a model form with system-created fields.

Review django.contrib.auth.forms.AuthenticationForm to understand how it works.