views.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:sourcelist 作者: greglinch 项目源码 文件源码
def get(self, request, uidb64, token):
        try:
            uid = force_text(urlsafe_base64_decode(uidb64))
            user = User.objects.get(pk=uid)
        except(TypeError, ValueError, OverflowError, User.DoesNotExist):
            user = None
        if user is not None and account_confirmation_token.check_token(user, token):
            ## set the Person to being approved
            person = Person.objects.get(email_address=user.email)
            person.approved_by_user = True
            person.save()
            # user.is_active = True
            # user.save()
            # login(request, user)
            # return redirect('home')
            return HttpResponse('Thank you for confirming your source profile.') # Now you can view the live entry {}.').format(live_url)
        else:
            return HttpResponse('Confirmation link is invalid!')

        ## see which token the user matches
        return render(request, 'confirmation.html', context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号