Allowing Session email address

This commit is contained in:
Mohamed ElKalioby
2019-03-11 13:07:05 +03:00
parent ce6a224818
commit c693007d62
2 changed files with 7 additions and 2 deletions

View File

@@ -106,7 +106,12 @@ def start(request):
def send_email(request):
body=render(request,"TrustedDevices/email.html",{}).content
from .Common import send
if send([request.user.email],"Add Trusted Device Link",body):
e=request.user.email
if e=="":
e=request.session.get("user",{}).get("email","")
if e=="":
res = "User has no email on the system."
elif send([e],"Add Trusted Device Link",body):
res="Sent Successfully"
else:
res="Error occured, please try again later."