feat(abm): abm completo de ciclos lectivos, aulas y reservas con proteccion de integridad y pruebas automatizadas
This commit is contained in:
@@ -20,14 +20,17 @@ def jwt_required(f):
|
||||
token = request.cookies.get('access_token')
|
||||
|
||||
if not token:
|
||||
from flask_login import current_user
|
||||
if current_user.is_authenticated and current_user.is_active:
|
||||
g.jwt_user = current_user
|
||||
g.jwt_payload = {'sub': str(current_user.id), 'role': getattr(current_user, 'role', '')}
|
||||
g.jwt_token = None
|
||||
g.real_admin_user = current_user
|
||||
g.is_impersonating = False
|
||||
return f(*args, **kwargs)
|
||||
try:
|
||||
from flask_login import current_user
|
||||
if current_user.is_authenticated and current_user.is_active:
|
||||
g.jwt_user = current_user
|
||||
g.jwt_payload = {'sub': str(current_user.id), 'role': getattr(current_user, 'role', '')}
|
||||
g.jwt_token = None
|
||||
g.real_admin_user = current_user
|
||||
g.is_impersonating = False
|
||||
return f(*args, **kwargs)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return jsonify({
|
||||
'error': 'Unauthorized',
|
||||
|
||||
Reference in New Issue
Block a user