-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from tomaspalma/feature/send-email
setup mailtrap email sending for demo purposes
- Loading branch information
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from django.core.mail import send_mail | ||
from datetime import datetime, timedelta | ||
from django.utils import timezone | ||
from django.http.response import HttpResponse | ||
|
@@ -371,6 +372,12 @@ def submit_direct_exchange(request): | |
if not(participant in tokens_to_generate): | ||
token = jwt.encode({"username": participant, "exchange_id": exchange_model.id, "exp": (datetime.datetime.now() + datetime.timedelta(seconds=VERIFY_EXCHANGE_TOKEN_EXPIRATION_SECONDS)).timestamp()}, JWT_KEY, algorithm="HS256") | ||
tokens_to_generate[participant] = token | ||
send_mail( | ||
'Confirmação de troca', | ||
f'https://localhost:3100/tts/verify_direct_exchange/{token}', | ||
'[email protected]', | ||
[f'up{participant}@up.pt'], | ||
fail_silently=False) | ||
inserted_exchange.save() | ||
|
||
# 2. Send confirmation email | ||
|