Exemplo n.º 1
0
def activate(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_activation_token.check_token(user, token):
        user.is_active = True
        user.save()
        return redirect('public:index')
Exemplo n.º 2
0
def activate(request, uidb64, token):
    try:
        uid = force_text(urlsafe_base64_decode(uidb64))
        user = MyUser.objects.get(pk=uid)
    except (TypeError, ValueError, OverflowError, MyUser.DoesNotExist):
        user = None

    if user is not None and account_activation_token.check_token(user, token):
        user.is_active = True
        user.email_confirmed = True
        user.save()
        login(request, user)
        return redirect('user_home')
    else:
        return render(request, 'registration/account_activation_invalid.html')
Exemplo n.º 3
0
def activate(request, uidb64, token):
    try:
        uid = force_text(urlsafe_base64_decode(uidb64))
        print(uid)
        user = User.objects.get(pk=uid)
    except (TypeError, ValueError, OverflowError, User.DoesNotExist):
        user = None
    if user is not None and account_activation_token.check_token(user, token):
        user.is_active = True
        user.save()
        Bookmark.objects.create(user=user)
        profile.objects.create(user=user)
        Follower.objects.create(follower=user)
        return redirect('http://127.0.0.1:8080/')
    else:
        return HttpResponse('Activation link is invalid!')
Exemplo n.º 4
0
def activate(request, uidb64, token):
    """
    Checks token, if valid, then user will active and login

    :param uidb64: used to generate uid
    :param token: to be passed in request
    :return: email
    :raise: BadRequest
    """
    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_activation_token.check_token(user, token):
        user.is_active = True
        user.save()
        return render(request, 'HomePage/confirmed_email.html')
    else:
        return HttpResponseBadRequest('Activation link is invalid!')
Exemplo n.º 5
0
Arquivo: views.py Projeto: systers/vms
def activate(request, uidb64, token):
    """
    Checks token, if valid, then user will active and login

    :param uidb64: used to generate uid
    :param token: to be passed in request
    :return: email
    :raise: BadRequest
    """
    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_activation_token.check_token(user, token):
        user.is_active = True
        user.save()
        return render(request, 'home/confirmed_email.html')
    else:
        return HttpResponseBadRequest('Activation link is invalid!')