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)
def logout(req): logout_method(req) return HttpResponseRedirect(reverse('shop:index'))
def logout(req): logout_method(req) return render(req, 'login.html')
def logout(request): logout_method(request) return TemplateResponse(request, 'store/login.html')
def logout(request): logout_method(request) return redirect('authentication:login')
def logout(request): logout_method(request) return redirect(reverse("home"))