DmitrMakeev
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1490,9 +1490,8 @@ def gc_forms():
|
|
1490 |
|
1491 |
|
1492 |
|
1493 |
-
# Глобальная переменная для управления верификацией
|
1494 |
curators = ["Anna", "Ekaterina", "Ivan", "Maria", "Sergey", "Olga", "Alex", "Natalia", "Dmitry", "Elena"]
|
1495 |
-
current_curator_index = 0
|
1496 |
|
1497 |
mt_avp = {
|
1498 |
'name': 'name',
|
@@ -1570,6 +1569,11 @@ mapp_templates = {
|
|
1570 |
}
|
1571 |
|
1572 |
DATABASE_NAME3 = 'data_gc.db'
|
|
|
|
|
|
|
|
|
|
|
1573 |
|
1574 |
def add_or_update_contact(contact_data, db_name):
|
1575 |
conn = sqlite3.connect(db_name)
|
@@ -1611,8 +1615,7 @@ def add_or_update_contact(contact_data, db_name):
|
|
1611 |
conn.commit()
|
1612 |
conn.close()
|
1613 |
|
1614 |
-
|
1615 |
-
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
|
1616 |
|
1617 |
@app.route('/ver_cur', methods=['GET'])
|
1618 |
def add_data_ver_cur():
|
@@ -1648,14 +1651,20 @@ def add_data_ver_cur():
|
|
1648 |
else:
|
1649 |
user_data['ws_st'] = user_data.get('ws_st', '')
|
1650 |
|
1651 |
-
password = None
|
1652 |
if gen_pass_start == "1":
|
1653 |
-
|
1654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1655 |
|
1656 |
try:
|
1657 |
add_or_update_contact(user_data, db_name)
|
1658 |
-
return jsonify({'status': 'success', 'message': f'User added with curator {user_data.get("curator", "not assigned")}', 'password':
|
1659 |
except Exception as e:
|
1660 |
logging.error(f"Error adding user: {e}")
|
1661 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
@@ -1707,14 +1716,20 @@ def add_data_ver_bonus():
|
|
1707 |
user_data['pr1'] = new_pr1
|
1708 |
conn.close()
|
1709 |
|
1710 |
-
password = None
|
1711 |
if gen_pass_start == "1":
|
1712 |
-
|
1713 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1714 |
|
1715 |
try:
|
1716 |
add_or_update_contact(user_data, db_name)
|
1717 |
-
return jsonify({'status': 'success', 'message': f'User added with curator {user_data.get("curator", "not assigned")}', 'password':
|
1718 |
except Exception as e:
|
1719 |
logging.error(f"Error adding user: {e}")
|
1720 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
@@ -1735,7 +1750,6 @@ def add_data_ver_bonus():
|
|
1735 |
|
1736 |
|
1737 |
|
1738 |
-
|
1739 |
def clean_phone_number_ss(phone_number):
|
1740 |
return re.sub(r'\D', '', phone_number)
|
1741 |
|
|
|
1490 |
|
1491 |
|
1492 |
|
1493 |
+
# Глобальная переменная для управления верификацией
|
1494 |
curators = ["Anna", "Ekaterina", "Ivan", "Maria", "Sergey", "Olga", "Alex", "Natalia", "Dmitry", "Elena"]
|
|
|
1495 |
|
1496 |
mt_avp = {
|
1497 |
'name': 'name',
|
|
|
1569 |
}
|
1570 |
|
1571 |
DATABASE_NAME3 = 'data_gc.db'
|
1572 |
+
current_curator_index = 0 # Initialize current curator index
|
1573 |
+
|
1574 |
+
def generate_password(length=8):
|
1575 |
+
letters_and_digits = string.ascii_letters + string.digits
|
1576 |
+
return ''.join(random.choice(letters_and_digits) for i in range(length))
|
1577 |
|
1578 |
def add_or_update_contact(contact_data, db_name):
|
1579 |
conn = sqlite3.connect(db_name)
|
|
|
1615 |
conn.commit()
|
1616 |
conn.close()
|
1617 |
|
1618 |
+
|
|
|
1619 |
|
1620 |
@app.route('/ver_cur', methods=['GET'])
|
1621 |
def add_data_ver_cur():
|
|
|
1651 |
else:
|
1652 |
user_data['ws_st'] = user_data.get('ws_st', '')
|
1653 |
|
|
|
1654 |
if gen_pass_start == "1":
|
1655 |
+
user_data['pr5'] = generate_password()
|
1656 |
+
else:
|
1657 |
+
conn = sqlite3.connect(db_name)
|
1658 |
+
cursor = conn.cursor()
|
1659 |
+
cursor.execute("SELECT pr5 FROM contacts WHERE email = ?", (user_data['email'],))
|
1660 |
+
result = cursor.fetchone()
|
1661 |
+
if result and result[0]:
|
1662 |
+
user_data['pr5'] = result[0]
|
1663 |
+
conn.close()
|
1664 |
|
1665 |
try:
|
1666 |
add_or_update_contact(user_data, db_name)
|
1667 |
+
return jsonify({'status': 'success', 'message': f'User added with curator {user_data.get("curator", "not assigned")}', 'password': user_data['pr5']})
|
1668 |
except Exception as e:
|
1669 |
logging.error(f"Error adding user: {e}")
|
1670 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
|
|
1716 |
user_data['pr1'] = new_pr1
|
1717 |
conn.close()
|
1718 |
|
|
|
1719 |
if gen_pass_start == "1":
|
1720 |
+
user_data['pr5'] = generate_password()
|
1721 |
+
else:
|
1722 |
+
conn = sqlite3.connect(db_name)
|
1723 |
+
cursor = conn.cursor()
|
1724 |
+
cursor.execute("SELECT pr5 FROM contacts WHERE email = ?", (user_data['email'],))
|
1725 |
+
result = cursor.fetchone()
|
1726 |
+
if result and result[0]:
|
1727 |
+
user_data['pr5'] = result[0]
|
1728 |
+
conn.close()
|
1729 |
|
1730 |
try:
|
1731 |
add_or_update_contact(user_data, db_name)
|
1732 |
+
return jsonify({'status': 'success', 'message': f'User added with curator {user_data.get("curator", "not assigned")}', 'password': user_data['pr5']})
|
1733 |
except Exception as e:
|
1734 |
logging.error(f"Error adding user: {e}")
|
1735 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
|
|
1750 |
|
1751 |
|
1752 |
|
|
|
1753 |
def clean_phone_number_ss(phone_number):
|
1754 |
return re.sub(r'\D', '', phone_number)
|
1755 |
|