예제 #1
0
def send_verification_email(request, user, new_email=None):
    """Send an email prompting the user to verify their email address."""

    if not new_email:  # verifying first email address
        user.email_verifications.all().delete()

        verification = generate_token(user)

        message = emailVerificationNeededEmail(request, verification.token)
        send_email(VERIFICATION_EMAIL,
                   [user.email],
                   message['subject'],
                   message['message'])

    else:  # verifying change of email address.
        verification = generate_token(user, new_email)

        message = emailChangeVerificationEmail(request, verification.token)
        send_email(VERIFICATION_EMAIL,
                   [new_email],
                   message['subject'],
                   message['message'])

        message = emailChangeNotificationEmail(request, new_email)
        send_email(VERIFICATION_EMAIL,
                   [user.email],
                   message['subject'],
                   message['message'])
예제 #2
0
def send_verification_email(request, user, new_email=None):
    """Send an email prompting the user to verify their email address."""

    if not new_email:  # verifying first email address
        user.email_verifications_old.all().delete()

        verification = generate_token(user)

        message = emailVerificationNeededEmail(request, verification.token)
        send_email(VERIFICATION_EMAIL,
                   [user.email],
                   message['subject'],
                   message['message'])

    else:  # verifying change of email address.
        verification = generate_token(user, new_email)

        message = emailChangeVerificationEmail(request, verification.token)
        send_email(VERIFICATION_EMAIL,
                   [new_email],
                   message['subject'],
                   message['message'])

        message = emailChangeNotificationEmail(request, new_email)
        send_email(VERIFICATION_EMAIL,
                   [user.email],
                   message['subject'],
                   message['message'])
예제 #3
0
def send_verification_email(request, userProfile, new_email=None):
    verification = EmailVerification.objects.create(
        user=userProfile,
        email=new_email,
        token=uuid4().hex[:30],
        expiry=timezone.now() + timedelta(hours=1))

    if new_email:
        emailMessage = emailMessages.emailChangeVerificationEmail(request, verification.token)
        send_email(VERIFICATION_EMAIL, [new_email], emailMessage['subject'],
                   emailMessage['message'])

        emailMessage = emailMessages.emailChangeNotificationEmail(request, new_email)
        send_email(VERIFICATION_EMAIL, [userProfile.user.email], emailMessage['subject'],
                   emailMessage['message'])

    else:
        emailMessage = emailMessages.emailVerificationNeededEmail(request, verification.token)

        send_email(VERIFICATION_EMAIL, [userProfile.user.email], emailMessage['subject'],
                   emailMessage['message'])
예제 #4
0
def send_verification_email(request, userProfile, new_email=None):
    verification = EmailVerification.objects.create(user=userProfile,
                                                    email=new_email,
                                                    token=uuid4().hex[:30],
                                                    expiry=timezone.now() +
                                                    timedelta(hours=1))

    if new_email:
        emailMessage = emailMessages.emailChangeVerificationEmail(
            request, verification.token)
        send_email(VERIFICATION_EMAIL, [new_email], emailMessage['subject'],
                   emailMessage['message'])

        emailMessage = emailMessages.emailChangeNotificationEmail(
            request, new_email)
        send_email(VERIFICATION_EMAIL, [userProfile.user.email],
                   emailMessage['subject'], emailMessage['message'])

    else:
        emailMessage = emailMessages.emailVerificationNeededEmail(
            request, verification.token)

        send_email(VERIFICATION_EMAIL, [userProfile.user.email],
                   emailMessage['subject'], emailMessage['message'])