Activa CSRF global en el portal (CsrfViewMiddleware)

- añade django.middleware.csrf.CsrfViewMiddleware a MIDDLEWARE (estaba ausente:
  el CSRF estaba desactivado en todo el sitio)
- head.html: $.ajaxSetup envía X-CSRFToken en todo POST AJAX de jQuery + expone
  window.CSRF_TOKEN (fuerza la cookie csrftoken en cada página)
- store_novawow.html: el fetch() nativo ahora manda X-CSRFToken (era el único que
  se rompía al activar el middleware)
- register.html: añade {% csrf_token %} al formulario
- retira @csrf_exempt de login/register/restore_character/restore_items
  (solo los webhooks stripe/sumup siguen exentos)
- auditoría previa: el resto de POST (AJAX jQuery + forms nativos con token) ya cubierto

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 17:42:34 +00:00
parent 89ea16ba4d
commit b5d46fad5c
6 changed files with 21 additions and 11 deletions
+1
View File
@@ -55,6 +55,7 @@
<div class="box-content">
<div class="body-box-content centered">
<form action="" method="POST" id="nw-create-form" accept-charset="utf-8">
{% csrf_token %}
<table class="middle-center-table">
<script src="{{ URL_PRINCIPAL }}/static/nw-themes/nw-ryu/nw-js-handlers/register.js"></script>
<tbody><tr>