def a_change_password(request):
u = User.objects.get(username=request.user)
if request.method == 'POST':
form = ChangePasswordForm(request.POST)
if form.is_valid():
old_password = request.POST.get("old_password")
new_pass = request.POST.get("new_password")
new_pass_rep = request.POST.get("new_password_repeat")
if check_password(old_password,u.password):
return HttpResponse('ok')
else:
return HttpResponse('bad')
else:
form = ChangePasswordForm()
return render(request, 'login/change_password.html',
{'form': form, 'user': u})