Skip to content

Commit

Permalink
Add conditions for sendgrid
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed May 25, 2024
1 parent cdad186 commit 5891225
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MagicalAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ def send_magic_link(self, email, otp, ip_address):
.replace("~", "%7E")
)
magic_link = f"{self.link}?token={token}"
if getenv("SENDGRID_API_KEY") and getenv("SENDGRID_FROM_EMAIL"):
if (
getenv("SENDGRID_API_KEY") != ""
and str(getenv("SENDGRID_API_KEY")).lower() != "none"
and getenv("SENDGRID_FROM_EMAIL") != ""
and str(getenv("SENDGRID_FROM_EMAIL")).lower() != "none"
):
send_email(
email=self.email,
subject="Magic Link",
Expand Down

0 comments on commit 5891225

Please sign in to comment.