Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -203,9 +203,10 @@ def get_db_connection_user():
|
|
| 203 |
def get_user():
|
| 204 |
email = request.args.get('email')
|
| 205 |
vk_id = request.args.get('vk_id')
|
|
|
|
| 206 |
|
| 207 |
-
if not email and not vk_id:
|
| 208 |
-
return jsonify({"error": "Either email or
|
| 209 |
|
| 210 |
conn = get_db_connection_user()
|
| 211 |
cursor = conn.cursor()
|
|
@@ -216,11 +217,16 @@ def get_user():
|
|
| 216 |
if email:
|
| 217 |
query += "email = ?"
|
| 218 |
params.append(email)
|
| 219 |
-
if email and vk_id:
|
| 220 |
query += " OR "
|
| 221 |
if vk_id:
|
| 222 |
query += "vk_id = ?"
|
| 223 |
params.append(vk_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
cursor.execute(query, params)
|
| 226 |
user = cursor.fetchone()
|
|
|
|
| 203 |
def get_user():
|
| 204 |
email = request.args.get('email')
|
| 205 |
vk_id = request.args.get('vk_id')
|
| 206 |
+
phone = request.args.get('phone')
|
| 207 |
|
| 208 |
+
if not email and not vk_id and not phone:
|
| 209 |
+
return jsonify({"error": "Either email, vk_id, or phone must be provided"}), 400
|
| 210 |
|
| 211 |
conn = get_db_connection_user()
|
| 212 |
cursor = conn.cursor()
|
|
|
|
| 217 |
if email:
|
| 218 |
query += "email = ?"
|
| 219 |
params.append(email)
|
| 220 |
+
if email and (vk_id or phone):
|
| 221 |
query += " OR "
|
| 222 |
if vk_id:
|
| 223 |
query += "vk_id = ?"
|
| 224 |
params.append(vk_id)
|
| 225 |
+
if vk_id and phone:
|
| 226 |
+
query += " OR "
|
| 227 |
+
if phone:
|
| 228 |
+
query += "phone = ?"
|
| 229 |
+
params.append(phone)
|
| 230 |
|
| 231 |
cursor.execute(query, params)
|
| 232 |
user = cursor.fetchone()
|