0

I have a collapse div with login/sign-up forms. How I can catch errors if they are and show them on page?

My form in html:

 <form method="post" action="{% url 'login' %}">
 {% csrf_token %}
    <p><label for="id_username">Username:</label> <input 
    id="id_username" type="text" name="username" maxlength="30" /></p>
    <p><label for="id_password">Password:</label> <input 
    type="password" name="password" id="id_password" /></p>

    <input type="submit" value="Log in" />
    <input type="hidden" name="next" value="{{ request.get_full_path }}" 
    />
</form>
sasha
  • 135
  • 11

1 Answers1

0

Dude use the inbuilt login, it offers you with encryption of password. the method your using is little messy i would recommend to go with django inbuilt authentication. here's the link,

https://simpleisbetterthancomplex.com/tutorial/2016/06/27/how-to-use-djangos-built-in-login-system.html