Spaces:
Sleeping
Sleeping
Update app.py
Browse filesfixed mail issue and profile pic issue
app.py
CHANGED
|
@@ -97,6 +97,11 @@ except Exception as e:
|
|
| 97 |
def send_health_email(to_email, health_score, key_risk_factor, diet_tags, exercise_tags):
|
| 98 |
smtp_email = os.getenv("SMTP_EMAIL")
|
| 99 |
smtp_password = os.getenv("SMTP_PASSWORD")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
if not smtp_email or not smtp_password or not to_email:
|
| 101 |
return
|
| 102 |
|
|
@@ -551,7 +556,7 @@ def upload_photo():
|
|
| 551 |
filename = f"{uid}_{uuid.uuid4().hex[:8]}.{ext}"
|
| 552 |
save_path = os.path.join("static", "avatars", filename)
|
| 553 |
photo.save(save_path)
|
| 554 |
-
photo_url = f"
|
| 555 |
return jsonify({"status": "ok", "photo_url": photo_url})
|
| 556 |
except Exception as e:
|
| 557 |
return jsonify({"error": str(e)}), 500
|
|
|
|
| 97 |
def send_health_email(to_email, health_score, key_risk_factor, diet_tags, exercise_tags):
|
| 98 |
smtp_email = os.getenv("SMTP_EMAIL")
|
| 99 |
smtp_password = os.getenv("SMTP_PASSWORD")
|
| 100 |
+
if smtp_email:
|
| 101 |
+
smtp_email = smtp_email.replace('"', '').replace("'", "").strip()
|
| 102 |
+
if smtp_password:
|
| 103 |
+
smtp_password = smtp_password.replace(" ", "").replace('"', '').replace("'", "")
|
| 104 |
+
|
| 105 |
if not smtp_email or not smtp_password or not to_email:
|
| 106 |
return
|
| 107 |
|
|
|
|
| 556 |
filename = f"{uid}_{uuid.uuid4().hex[:8]}.{ext}"
|
| 557 |
save_path = os.path.join("static", "avatars", filename)
|
| 558 |
photo.save(save_path)
|
| 559 |
+
photo_url = f"/static/avatars/{filename}"
|
| 560 |
return jsonify({"status": "ok", "photo_url": photo_url})
|
| 561 |
except Exception as e:
|
| 562 |
return jsonify({"error": str(e)}), 500
|