#34891: force_str(urlsafe_base64_decode(uidb64)) returns object not value
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
jslovern391 |
Type: Bug | Status: new
Component: Utilities | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: | django.utils.encoding
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Trying to decode:
PHByb3BlcnR5IG9iamVjdCBhdCAweDAwMDAwMjU1M0ZBNTlEQTA-
bvlp6u-9b15d1fd6d30b90e81623812e9bc8d74
force_str(urlsafe_base64_decode(uidb64)) returns:
Field 'id' expected a number but got b'<property object at
0x000002553FA59DA0>'.
The above exception (invalid literal for int() with base 10: b'<property
object at 0x000002553FA59DA0>') was the direct cause of the following
exception:
Code:
def activate(request, uidb64, token):
try:
uid = force_str(urlsafe_base64_decode(uidb64))
user = CustomUser.objects.get(pk=uid)
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!')
--
Ticket URL: <https://code.djangoproject.com/ticket/34891>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018b011bd0dd-9f1b6015-a020-44a7-8306-f7338a3357e6-000000%40eu-central-1.amazonses.com.