mirror of
https://github.com/tildeclub/fosspay.git
synced 2026-07-24 23:09:25 +00:00
make email send issues non-fatal.
This commit is contained in:
10
cronjob.py
10
cronjob.py
@@ -46,14 +46,20 @@ for donation in donations:
|
|||||||
except stripe.error.CardError:
|
except stripe.error.CardError:
|
||||||
donation.active = False
|
donation.active = False
|
||||||
db.commit()
|
db.commit()
|
||||||
send_declined(user, donation.amount)
|
try:
|
||||||
|
send_declined(user, donation.amount)
|
||||||
|
except Exception as e:
|
||||||
|
print(f" • declined email failed: {e}")
|
||||||
print(" • declined")
|
print(" • declined")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
send_thank_you(user, donation.amount, True)
|
|
||||||
donation.updated = datetime.now()
|
donation.updated = datetime.now()
|
||||||
donation.payments += 1
|
donation.payments += 1
|
||||||
db.commit()
|
db.commit()
|
||||||
|
try:
|
||||||
|
send_thank_you(user, donation.amount, True)
|
||||||
|
except Exception as e:
|
||||||
|
print(f" • thank-you email failed: {e}")
|
||||||
else:
|
else:
|
||||||
print(f"Skipping {donation}")
|
print(f"Skipping {donation}")
|
||||||
|
|
||||||
|
|||||||
@@ -269,8 +269,14 @@ def donate():
|
|||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
send_thank_you(user, amount, type == DonationType.monthly)
|
try:
|
||||||
send_new_donation(user, donation)
|
send_thank_you(user, amount, type == DonationType.monthly)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Thank-you email failed: {e}")
|
||||||
|
try:
|
||||||
|
send_new_donation(user, donation)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"New donation email failed: {e}")
|
||||||
|
|
||||||
if new_account:
|
if new_account:
|
||||||
return { "success": True, "new_account": new_account, "password_reset": user.password_reset }
|
return { "success": True, "new_account": new_account, "password_reset": user.password_reset }
|
||||||
@@ -283,7 +289,11 @@ def issue_password_reset(email):
|
|||||||
return render_template("reset.html", errors="No one with that email found.")
|
return render_template("reset.html", errors="No one with that email found.")
|
||||||
user.password_reset = binascii.b2a_hex(os.urandom(20)).decode("utf-8")
|
user.password_reset = binascii.b2a_hex(os.urandom(20)).decode("utf-8")
|
||||||
user.password_reset_expires = datetime.now() + timedelta(days=1)
|
user.password_reset_expires = datetime.now() + timedelta(days=1)
|
||||||
send_password_reset(user)
|
try:
|
||||||
|
send_password_reset(user)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Password reset email failed: {e}")
|
||||||
|
return render_template("reset.html", errors="Could not send password reset email.")
|
||||||
db.commit()
|
db.commit()
|
||||||
return render_template("reset.html", done=True)
|
return render_template("reset.html", done=True)
|
||||||
|
|
||||||
@@ -346,7 +356,10 @@ def cancel(id):
|
|||||||
abort(400)
|
abort(400)
|
||||||
donation.active = False
|
donation.active = False
|
||||||
db.commit()
|
db.commit()
|
||||||
send_cancellation_notice(current_user, donation)
|
try:
|
||||||
|
send_cancellation_notice(current_user, donation)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Cancellation email failed: {e}")
|
||||||
return redirect("../panel")
|
return redirect("../panel")
|
||||||
|
|
||||||
@html.route("/invoice/<id>")
|
@html.route("/invoice/<id>")
|
||||||
|
|||||||
Reference in New Issue
Block a user