tokens.py 495 Bytes
Newer Older
1 2
"""Tokens module."""

3 4 5 6 7
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils import six


class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
8 9
    """Class to generate account activation tokens."""

10 11 12 13 14 15 16 17
    def _make_hash_value(self, user, timestamp):
        return (
            six.text_type(user.pk) + six.text_type(timestamp) +
            six.text_type(user.email_confirmed)
        )


account_activation_token = AccountActivationTokenGenerator()