django_magazine/accounts/token.py

12 lines
409 B
Python
Raw Normal View History

2023-01-31 11:20:57 +00:00
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from six import text_type
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
def _make_hash_value(self, user, timestamp):
return (text_type(user.pk) +
text_type(timestamp) +
text_type(user.is_active)
)
account_activation_token = AccountActivationTokenGenerator()