fix(login): mueve login a /pos/login2 para evitar cache viejo
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled

- /pos/login redirige a /pos/login2 (no-store).
- /pos/login2 sirve la plantilla actualizada que envia employee_id.
- nginx redirige / a /pos/login2.

Esto evita que navegadores/PWA con cache antigua sigan usando la version
que no enviaba el empleado seleccionado.
This commit is contained in:
2026-06-30 17:15:42 +00:00
parent 50f2c21da7
commit 8ce6c398d4
2 changed files with 9 additions and 9 deletions

View File

@@ -144,15 +144,15 @@ def create_app():
return send_from_directory('static/pwa', 'icon-192.png', mimetype='image/png')
@app.route('/pos/login')
def pos_login():
# Bust browser cache by always serving the login page under a versioned URL.
if request.args.get('v') != '34':
response = make_response(redirect('/pos/login?v=34'))
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = '0'
return response
def pos_login_legacy():
# Redirect to the new login path to bypass any stale browser/SW cache
# of the old /pos/login page that did not send employee_id.
response = make_response(redirect('/pos/login2'))
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
return response
@app.route('/pos/login2')
def pos_login():
response = make_response(render_template('login.html',
tenant_id=getattr(g, 'tenant_id', None),
tenant_name=getattr(g, 'tenant_name', None),