javascript - incorrect password and receive an alert from program django -
please im new django , want add source code project, when user try connect, if password equal "test" want template showed again user alert javascript says the password incorrect here code: views.py
#authentification def home(request): if request.method=='post': admin1=administrateurform(request.post) if admin1.is_valid(): nom=admin1.cleaned_data['login'] pwd=admin1.cleaned_data['passe'] admin1 in administrateur.objects.all(): if admin1.login==nom , admin1.passe==pwd: return redirect(menuprincipal) else: return redirect(home) else: admin1=administrateurform() return render(request,'gpi/index.html',locals())
template: index.html:
above of code put 1 :
<body id="page-top" class="index"> {% if pwd == "test" %} <script type="text/javascript">alert("mot de passe ou login incorrect !")</script> {% else %} {% endif %}
Comments
Post a Comment