Basic release 1-Aug-2024
This commit is contained in:
26
rog/utils.py
26
rog/utils.py
@ -3,6 +3,8 @@ from django.template.loader import render_to_string
|
||||
from django.conf import settings
|
||||
import logging
|
||||
from django.core.mail import send_mail
|
||||
from django.urls import reverse
|
||||
import uuid
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -46,7 +48,12 @@ def send_verification_email(user, activation_link):
|
||||
|
||||
# 既にユーザーになっている人にチームへの参加要請メールを出す。
|
||||
#
|
||||
def send_team_join_email(sender,user,team,activation_link):
|
||||
def send_team_join_email(sender,user,team):
|
||||
activation_link = request.build_absolute_uri(
|
||||
reverse('activate-member', args=[user.id, team.id])
|
||||
)
|
||||
logger.info(f"request: {request}")
|
||||
|
||||
context = {
|
||||
'name': user.lastname or user.email,
|
||||
'invitor': sender.lastname,
|
||||
@ -63,22 +70,31 @@ def send_team_join_email(sender,user,team,activation_link):
|
||||
# その人がユーザー登録して、ユーザー登録されるとメンバーになる。
|
||||
# アプリからユーザー登録するため、アプリのダウンロードリンクも送る。
|
||||
#
|
||||
def send_invitation_email(sender,user,team,activation_link):
|
||||
def send_invitation_email(sender,request,user_email,team):
|
||||
|
||||
verification_code = uuid.uuid4() # UUIDを生成
|
||||
activation_link = request.build_absolute_uri(
|
||||
reverse('activate-new-member', args=[verification_code, team.id])
|
||||
)
|
||||
|
||||
|
||||
context = {
|
||||
'name': user.firstname or user.email,
|
||||
'name': user_email,
|
||||
'invitor': sender.lastname,
|
||||
'team_name': team.team_name,
|
||||
'activation_link': activation_link,
|
||||
'app_download_link': settings.APP_DOWNLOAD_LINK,
|
||||
'android_download_link': settings.ANDROID_DOWNLOAD_LINK,
|
||||
}
|
||||
|
||||
subject, body = load_email_template('invitation_new_email.txt', context)
|
||||
share_send_email(subject,body,user.email)
|
||||
share_send_email(subject,body,user_email)
|
||||
|
||||
|
||||
|
||||
# 招待された後にユーザー登録された場合、ヴェリフィケーションでチーム参加登録される。
|
||||
#
|
||||
def send_invitaion_and_verification_email(sender, user, team, activation_link):
|
||||
def send_invitaion_and_verification_email(user, team, activation_link):
|
||||
context = {
|
||||
'name': user.firstname or user.email,
|
||||
'activation_link': activation_link,
|
||||
|
||||
Reference in New Issue
Block a user