Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activation link is invalid! #1

Open
jslovern391 opened this issue Oct 5, 2023 · 3 comments
Open

Activation link is invalid! #1

jslovern391 opened this issue Oct 5, 2023 · 3 comments

Comments

@jslovern391
Copy link

First I want to say thanks so much for this documentation. I have been looking for something like this for a CustomUser.

First thing the email shows the HTML.

Hello ,

Please click the link below to activate your account:

Activate your account">

If you did not register on our site, please ignore this message.

Best regards,
Your Website Team

Second thing is that the link is invalid and trying to figure out where the issue is.

Thanks much.

@jslovern391
Copy link
Author

I added a log to this function and it returns nothing.

def activate(request, uidb64, token):
try:
uid = force_str(urlsafe_base64_decode(uidb64))
user = CustomUser.objects.get(pk=uid)
file = open('D:\OneDrive\Rock Tech\path.txt', 'a')
file.write(uidb64)
file.write(token)
file.close()
except (TypeError, ValueError, OverflowError, CustomUser.DoesNotExist):
user = None

if user is not None and account_activation_token.check_token(user, token):
    user.is_active = True
    user.save()
    login(request, user)
    return redirect('account_activation_complete')
else:
    return HttpResponseBadRequest('Activation link is invalid!')

@jslovern391
Copy link
Author

So the uid is giving a property not a value

<property object at 0x000001D3123D9DA0>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant