示例#1
0
def delete_account(req):
    context = {}
    if req.method == 'POST':
        username = req.user.get_username()
        password = req.POST['delete-password']
        text_delete = req.POST['delete-confirm']
        valid_user = authenticate(req, username=username, password=password)
        if valid_user:  ### Check if password is correct
            if text_delete == 'delete':
                logout_method(req)
                user = User.objects.get(username=username)
                user.delete()
                return HttpResponseRedirect(reverse('login'))
            else:
                context = {'message': '\'delete\' was not typed correctly.'}
        else:
            context = {'message': 'Wrong password.'}

    return render(req, 'delete_account.html', context)
示例#2
0
def logout(req):

    logout_method(req)
    return HttpResponseRedirect(reverse('shop:index'))
示例#3
0
def logout(req):
    logout_method(req)
    return render(req, 'login.html')
示例#4
0
def logout(request):
    logout_method(request)
    return TemplateResponse(request, 'store/login.html')
示例#5
0
def logout(request):
    logout_method(request)
    return redirect('authentication:login')
示例#6
0
def logout(request):
    logout_method(request)
    return redirect(reverse("home"))