accounts/views.py
def activate_user(request, uidb64, token):
    """Validate link and mark user as active else return error and redirect response."""
    if uidb64 is not None and token is not None:
        uid = force_text(urlsafe_base64_decode(uidb64))
        user = CustomUser.objects.get(pk=uid)
        if default_token_generator.check_token(user, token) and not user.is_active:
            user.is_active = True
            user.save()
            messages.success(request, 'Email verified! Proceed to login.')
            return HttpResponseRedirect(reverse('accounts:login_user'))

    messages.error(request, 'Invalid link.')
    return HttpResponseRedirect(reverse('home_page'))
Validate link and mark user as active else return error and redirect response.
Validate link and mark user as active else return error and redirect response.
Validate link and mark user as active else return error and redirect response .
def activate_user(request, uidb64, token):
    if uidb64 is not None and token is not None:
        uid = force_text(urlsafe_base64_decode(uidb64))
        user = CustomUser.objects.get(pk=uid)
        if default_token_generator.check_token(user, token) and not user.is_active:
            user.is_active = True
            user.save()
            messages.success(request, 'Email verified! Proceed to login.')
            return HttpResponseRedirect(reverse('accounts:login_user'))
    messages.error(request, 'Invalid link.')
    return HttpResponseRedirect(reverse('home_page'))
def activate_user ( request , uidb64 , token ) : if uidb64 is not None and token is not None : uid = force_text ( urlsafe_base64_decode ( uidb64 ) ) user = CustomUser . objects . get ( pk = uid ) if default_token_generator . check_token ( user , token ) and not user . is_active : user . is_active = True user . save ( ) messages . success ( request , 'Email verified! Proceed to login.' ) return HttpResponseRedirect ( reverse ( 'accounts:login_user' ) ) messages . error ( request , 'Invalid link.' ) return HttpResponseRedirect ( reverse ( 'home_page' ) )
Validate link and mark user as active else return error and redirect response.
Validate link and mark user as active else return error and redirect response .
"""Validate link and mark user as active else return error and redirect response."""
request
uidb64
token