Пример #1
0
def user_remove(request):
    is_confirmation = 'remove_confirm' in request.session
    if is_confirmation:
        if request.method == 'POST':
            remove_user(request.user, request)
            rotate_token(request)
            logout(request)
            messages.success(
                request,
                _('Your account has been removed.')
            )
            return redirect('home')
        else:
            confirm_form = EmptyConfirmForm(request)

    elif request.method == 'POST':
        confirm_form = PasswordConfirmForm(request, request.POST)
        if confirm_form.is_valid():
            session_ratelimit_reset(request)
            store_userid(request, remove=True)
            request.GET = {'email': request.user.email}
            return social_complete(request, 'email')
    else:
        confirm_form = PasswordConfirmForm(request)

    return render(
        request,
        'accounts/removal.html',
        {
            'confirm_form': confirm_form,
            'is_confirmation': is_confirmation,
        }
    )
Пример #2
0
def user_remove(request):
    if request.method == 'POST':
        confirm_form = PasswordConfirmForm(request, request.POST)
        if confirm_form.is_valid():
            remove_user(request.user)
            logout(request)
            messages.success(request, _('Your account has been removed.'))
            return redirect('home')
    else:
        confirm_form = PasswordConfirmForm(request)

    return render(request, 'accounts/removal.html', {
        'confirm_form': confirm_form,
    })
Пример #3
0
def user_remove(request):
    if appsettings.DEMO_SERVER and request.user.username == "demo":
        return deny_demo(request)

    if request.method == "POST":
        remove_user(request.user)

        logout(request)

        messages.success(request, _("Your account has been removed."))

        return redirect("home")

    return render(request, "accounts/removal.html")
Пример #4
0
def user_remove(request):
    if request.method == 'POST':
        remove_user(request.user)

        logout(request)

        messages.info(request, _('Your account has been removed.'))

        return redirect('home')

    return render(
        request,
        'accounts/removal.html',
    )
Пример #5
0
def user_remove(request):
    if appsettings.DEMO_SERVER and request.user.username == 'demo':
        return deny_demo(request)

    if request.method == 'POST':
        remove_user(request.user)

        logout(request)

        messages.success(request, _('Your account has been removed.'))

        return redirect('home')

    return render(
        request,
        'accounts/removal.html',
    )
Пример #6
0
def user_remove(request):
    if request.method == 'POST':
        remove_user(request.user)

        logout(request)

        messages.info(
            request,
            _('Your account has been removed.')
        )

        return redirect('home')

    return render(
        request,
        'accounts/removal.html',
    )
Пример #7
0
def user_remove(request):
    if appsettings.DEMO_SERVER and request.user.username == 'demo':
        return deny_demo(request)

    if request.method == 'POST':
        remove_user(request.user)

        logout(request)

        messages.success(
            request,
            _('Your account has been removed.')
        )

        return redirect('home')

    return render(
        request,
        'accounts/removal.html',
    )
Пример #8
0
def user_remove(request):
    if request.method == 'POST':
        confirm_form = PasswordConfirmForm(request, request.POST)
        if confirm_form.is_valid():
            remove_user(request.user)
            logout(request)
            messages.success(
                request,
                _('Your account has been removed.')
            )
            return redirect('home')
    else:
        confirm_form = PasswordConfirmForm(request)

    return render(
        request,
        'accounts/removal.html',
        {
            'confirm_form': confirm_form,
        }
    )