[Answered ]-Django authenticate user does not work after logging in

1👍

Change your form like this

<form class="bg-white rounded-5 shadow-5-strong p-5" method="post" action="{% url 'users:login_user' %}">
            {% csrf_token %}
            
          <!-- Email input -->
          <div class="form-outline mb-4">
            <label class="form-label" for="form1Example1">Email address</label>
            <input type="email" name="email" id="form1Example1" class="form-control" />
            
          </div>

          <!-- Password input -->
          <div class="form-outline mb-4">
            <label class="form-label" for="form1Example2">Password</label>
            <input type="password" name="password" type="password" id="form1Example2" class="form-control" />
            
          </div>

          <!-- Submit button -->
          <button type="submit" class="btn btn-primary btn-block">Sign in</button>
</form>

MultiValueDictKeyError at /users/login/ ‘password’

this is because you’re trying to access password value from request like this request.POST['password'] but you’ve not set name to your input(password) that’s why it is giving you an error

Leave a comment