Let socketio decorators return instead of randomly emiting messages.

This commit is contained in:
Patrick Jentsch 2021-09-22 13:49:22 +02:00
parent 0d96a572e4
commit 371cd30893

View File

@ -38,8 +38,7 @@ def socketio_admin_required(f):
if current_user.is_administrator: if current_user.is_administrator:
return f(*args, **kwargs) return f(*args, **kwargs)
else: else:
response = {'code': 401, 'msg': 'Unauthorized'} return {'code': 403, 'msg': 'Forbidden'}
socketio.emit(request.event['message'], response, room=request.sid)
return wrapped return wrapped
@ -49,6 +48,5 @@ def socketio_login_required(f):
if current_user.is_authenticated: if current_user.is_authenticated:
return f(*args, **kwargs) return f(*args, **kwargs)
else: else:
response = {'code': 401, 'msg': 'Unauthorized'} return {'code': 401, 'msg': 'Unauthorized'}
socketio.emit(request.event['message'], response, room=request.sid)
return wrapped return wrapped