예제 #1
0
def send_user_reset_password_email(user_id):
    from core.users.models import UserProfile
    user = UserProfile.objects.filter(id=user_id).first()
    if not user:
        return user

    html_body = render_to_string('password_reset.html', {
        'user': user,
        'url': user.reset_password_url,
        'web_url': web_url(),
    })
    mail = EmailMessage(subject=PASSWORD_RESET_MAIL_SUBJECT,
                        body=html_body,
                        to=[user.email])
    mail.content_subtype = "html"
    mail.send()
    return mail
예제 #2
0
 def reset_password_url(self):
     return "{}/#/accounts/{}/password/reset/{}/".format(
         web_url(), self.username, self.verification_token)
예제 #3
0
 def email_verification_url(self):
     return "{}/#/accounts/{}/verify/{}/".format(web_url(), self.username,
                                                 self.verification_token)