Update app.py
Browse files
app.py
CHANGED
@@ -702,6 +702,18 @@ def add_user_home():
|
|
702 |
def user():
|
703 |
global current_curator_index
|
704 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
veref_on_off = request.args.get('ver', '0')
|
706 |
curator_on_off = request.args.get('cur', '0')
|
707 |
db_name = request.args.get('db', 'data_gc.db') # Получаем имя базы данных из запроса
|
@@ -733,11 +745,12 @@ def user():
|
|
733 |
|
734 |
try:
|
735 |
add_or_update_contact(user_data, db_name)
|
736 |
-
return jsonify({'status': 'success', 'message': f'User added {user_data.get("curator", "not assigned")}'})
|
737 |
except Exception as e:
|
738 |
logging.error(f"Error adding user: {e}")
|
739 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
740 |
|
|
|
741 |
@app.route('/add_user_mess', methods=['GET'])
|
742 |
def add_user_mess():
|
743 |
global current_curator_index
|
|
|
702 |
def user():
|
703 |
global current_curator_index
|
704 |
|
705 |
+
# Получаем параметры API-ключа и email из запроса
|
706 |
+
api_sys = request.args.get('api_sys')
|
707 |
+
email = request.args.get('email')
|
708 |
+
|
709 |
+
# Проверка API-ключа
|
710 |
+
if api_sys != os.getenv('api_key_sys'):
|
711 |
+
return jsonify({"error": "Unauthorized access"}), 403
|
712 |
+
|
713 |
+
# Проверка email
|
714 |
+
if not email:
|
715 |
+
return jsonify({'error': 'Email is required'}), 400
|
716 |
+
|
717 |
veref_on_off = request.args.get('ver', '0')
|
718 |
curator_on_off = request.args.get('cur', '0')
|
719 |
db_name = request.args.get('db', 'data_gc.db') # Получаем имя базы данных из запроса
|
|
|
745 |
|
746 |
try:
|
747 |
add_or_update_contact(user_data, db_name)
|
748 |
+
return jsonify({'status': 'success', 'message': f'User added {user_data.get("curator", "not assigned")}'}), 200
|
749 |
except Exception as e:
|
750 |
logging.error(f"Error adding user: {e}")
|
751 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
752 |
|
753 |
+
|
754 |
@app.route('/add_user_mess', methods=['GET'])
|
755 |
def add_user_mess():
|
756 |
global current_curator_index
|