CTF Platform API basic auth
Addded ctf platform Flask app with basic auth functions register, login, logout Added ctf platform database design (MySQL Workbench) Added forward engineered SQL file Added wsgi startup script Installed various python dependencies README.md Updated .gitignore Updated
This commit is contained in:
11
ctf_platform/api/helper_functions.py
Normal file
11
ctf_platform/api/helper_functions.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def build_response_dict(success, action, message, reason=None):
|
||||
response_dict = {}
|
||||
if success:
|
||||
response_dict['data'] = { action: 'success', 'message': message}
|
||||
if reason is not None:
|
||||
response_dict['data']['reason'] = reason
|
||||
elif not success:
|
||||
response_dict['error'] = { action: 'failed', 'message': message}
|
||||
if reason is not None:
|
||||
response_dict['error']['reason'] = reason
|
||||
return response_dict
|
||||
Reference in New Issue
Block a user