fix(login): mueve login a /pos/login2 para evitar cache viejo
- /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:
@@ -74,7 +74,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location = / {
|
location = / {
|
||||||
return 302 /pos/login?v=34;
|
return 302 /pos/login2;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|||||||
16
pos/app.py
16
pos/app.py
@@ -144,15 +144,15 @@ def create_app():
|
|||||||
return send_from_directory('static/pwa', 'icon-192.png', mimetype='image/png')
|
return send_from_directory('static/pwa', 'icon-192.png', mimetype='image/png')
|
||||||
|
|
||||||
@app.route('/pos/login')
|
@app.route('/pos/login')
|
||||||
def pos_login():
|
def pos_login_legacy():
|
||||||
# Bust browser cache by always serving the login page under a versioned URL.
|
# Redirect to the new login path to bypass any stale browser/SW cache
|
||||||
if request.args.get('v') != '34':
|
# of the old /pos/login page that did not send employee_id.
|
||||||
response = make_response(redirect('/pos/login?v=34'))
|
response = make_response(redirect('/pos/login2'))
|
||||||
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
|
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
|
||||||
response.headers['Pragma'] = 'no-cache'
|
return response
|
||||||
response.headers['Expires'] = '0'
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
@app.route('/pos/login2')
|
||||||
|
def pos_login():
|
||||||
response = make_response(render_template('login.html',
|
response = make_response(render_template('login.html',
|
||||||
tenant_id=getattr(g, 'tenant_id', None),
|
tenant_id=getattr(g, 'tenant_id', None),
|
||||||
tenant_name=getattr(g, 'tenant_name', None),
|
tenant_name=getattr(g, 'tenant_name', None),
|
||||||
|
|||||||
Reference in New Issue
Block a user