fix(auth): restringe workshop/mecanico solo por servidor y cookie
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled

- Elimina el script inline que redirigia a todos los usuarios.
- auth_bp.py: la respuesta de login ahora setea cookie pos_role.
- app.py: before_request redirige a /pos/workshop solo cuando la cookie
  indica rol workshop/mechanic (no depende de JS cacheado).
- login.js/login.min.js/app-init.js: sincronizan/limpian la cookie pos_role
  junto con el token en login y logout.

Tests: 35 passed
This commit is contained in:
2026-06-30 16:57:11 +00:00
parent 688ea8c70c
commit a37e60eb2a
22 changed files with 42 additions and 243 deletions

View File

@@ -118,6 +118,7 @@
localStorage.removeItem('pos_employee');
localStorage.removeItem('pos_tenant_id');
localStorage.removeItem('pos_cart');
document.cookie = 'pos_role=; path=/pos; SameSite=Lax; expires=Thu, 01 Jan 1970 00:00:00 GMT';
window.location.href = '/pos/login';
};