# Path: apps/core/models.py
# class EmailAuthToken(models.Model):
#     """
#     denotes single email auth token for an user
#     - tokenid:     unique token id
#     - user:        user object
#     - expire_time: expire time; < 24 hours
#     """
#     tokenid = models.CharField(max_length=48, primary_key=True)
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     expire_time = models.DateTimeField()
# 
#     def __str__(self):
#         return f'{self.user} - {self.tokenid}'
# 
# class ResetPWToken(models.Model):
#     """
#     denotes single password reset token for an user
#     - tokenid:     unique token id
#     - user:        user object
#     - expire_time: expire time; < 24 hours
#     """
#     tokenid = models.CharField(max_length=48, primary_key=True)
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     expire_time = models.DateTimeField()
# 
#     def __str__(self):
#         return f'{self.user} - {self.tokenid}'


import datetime
from secrets import token_hex
from django.conf import settings
from django.core.mail import send_mail
from django.utils import timezone
from apps.core.models import EmailAuthToken, ResetPWToken
    '<br/>'
    '<h3>Confirm your password reset</h3>'
    '<p>Hi, {name}</p>'
    '<p>You tried to reset the password of your SPARCS SSO account.</p>'
    '<p>To reset your password, click the link below:</p>'
    '<p><a href="{link}">{link}</a></p>'
    '<p>If you did not request a password reset, please ignore this email.</p>'
)

EMAIL_AUTH_MSG_TITLE = '[SPARCS SSO] 이메일 인증 / Email Authentication'
EMAIL_NEWBIE_MSG_BODY = (
    '<h3>SPARCS SSO 이메일 인증</h3>'
    '<p>안녕하세요, {name}님</p>'
    '<p>SPARCS SSO 회원 가입을 환영합니다!</p>'
    '<p>다음 링크를 클릭하거나 주소창에 붙여 넣어 이메일 {email}을 인증할 수 있습니다.</p>'
    '<p><a href="{link}">{link}</a></p><br/>'
    '<p style="color:red"><b>만일 인증을 요청한 적이 없다면, '
    '절대로 링크를 클릭하지 마세요.</b></p>'
    '<br/>'
    '<h3>Verify your email address</h3>'
    '<p>Hi, {name}</p>'
    '<p>Thank you for signing in to SPARCS SSO!</p>'
    '<p>To verify your email address {email}, click the link below:</p>'
    '<p><a href="{link}">{link}</a></p><br/>'
    '<p style="color:red"><b>If you did not change your email address, '
    'please DO NOT click the link.</b></p>'
)
EMAIL_AUTH_MSG_BODY = (
    '<h3>SPARCS SSO 이메일 인증</h3>'
    '<p>안녕하세요, {name}님</p>'

# Path: apps/core/models.py
# class EmailAuthToken(models.Model):
#     """
#     denotes single email auth token for an user
#     - tokenid:     unique token id
#     - user:        user object
#     - expire_time: expire time; < 24 hours
#     """
#     tokenid = models.CharField(max_length=48, primary_key=True)
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     expire_time = models.DateTimeField()
# 
#     def __str__(self):
#         return f'{self.user} - {self.tokenid}'
# 
# class ResetPWToken(models.Model):
#     """
#     denotes single password reset token for an user
#     - tokenid:     unique token id
#     - user:        user object
#     - expire_time: expire time; < 24 hours
#     """
#     tokenid = models.CharField(max_length=48, primary_key=True)
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     expire_time = models.DateTimeField()
# 
#     def __str__(self):
#         return f'{self.user} - {self.tokenid}'


# Path: apps/core/backends/token.py
import datetime
from secrets import token_hex
from django.conf import settings
from django.core.mail import send_mail
from django.utils import timezone
from apps.core.models import EmailAuthToken, ResetPWToken

    '<br/>'
    '<h3>Confirm your password reset</h3>'
    '<p>Hi, {name}</p>'
    '<p>You tried to reset the password of your SPARCS SSO account.</p>'
    '<p>To reset your password, click the link below:</p>'
    '<p><a href="{link}">{link}</a></p>'
    '<p>If you did not request a password reset, please ignore this email.</p>'
)

EMAIL_AUTH_MSG_TITLE = '[SPARCS SSO] 이메일 인증 / Email Authentication'
EMAIL_NEWBIE_MSG_BODY = (
    '<h3>SPARCS SSO 이메일 인증</h3>'
    '<p>안녕하세요, {name}님</p>'
    '<p>SPARCS SSO 회원 가입을 환영합니다!</p>'
    '<p>다음 링크를 클릭하거나 주소창에 붙여 넣어 이메일 {email}을 인증할 수 있습니다.</p>'
    '<p><a href="{link}">{link}</a></p><br/>'
    '<p style="color:red"><b>만일 인증을 요청한 적이 없다면, '
    '절대로 링크를 클릭하지 마세요.</b></p>'
    '<br/>'
    '<h3>Verify your email address</h3>'
    '<p>Hi, {name}</p>'
    '<p>Thank you for signing in to SPARCS SSO!</p>'
    '<p>To verify your email address {email}, click the link below:</p>'
    '<p><a href="{link}">{link}</a></p><br/>'
    '<p style="color:red"><b>If you did not change your email address, '
    'please DO NOT click the link.</b></p>'
)
EMAIL_AUTH_MSG_BODY = (
    '<h3>SPARCS SSO 이메일 인증</h3>'
    '<p>안녕하세요, {name}님</p>'

    '<p>SPARCS SSO 계정에 대한 이메일 주소 변경 요청이 있었습니다.</p>'