Performance: Password change and reset
MEDIUM IMPACT
This affects page load speed and interaction responsiveness during password change and reset flows.
from django.views.decorators.csrf import csrf_exempt from django.http import JsonResponse @csrf_exempt def password_reset_api(request): if request.method == 'POST': form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return JsonResponse({'success': True}) else: return JsonResponse({'errors': form.errors}, status=400) return JsonResponse({'error': 'Invalid method'}, status=405)
def password_reset(request): if request.method == 'POST': form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return redirect('password_reset_done') else: form = PasswordResetForm() return render(request, 'password_reset.html', {'form': form})
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full page reload on form submit | High (full DOM reload) | Multiple (full page) | High (full repaint) | [X] Bad |
| AJAX form submission with partial update | Low (partial DOM update) | Single or none | Low (partial repaint) | [OK] Good |