We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40b67c3 commit 354dd81Copy full SHA for 354dd81
app/main.py
@@ -180,6 +180,14 @@ def delete_forwarder(alias):
180
print(f"Error deleting forwarder: {e}")
181
return jsonify({'error': str(e)}), 500
182
183
+ # Add this after creating the app
184
+@app.before_request
185
+def check_session():
186
+ """Ensure session is valid for API routes"""
187
+ if request.path.startswith(('/api/', '/settings/api/', '/admin/api/')):
188
+ if not current_user.is_authenticated:
189
+ return jsonify({'error': 'Authentication required', 'redirect': '/login'}), 401
190
+
191
return app
192
193
if __name__ == '__main__':
0 commit comments