From d5c5ad210ba91463cbe66f7a5d61dcd39d6d1ff2 Mon Sep 17 00:00:00 2001 From: fathonidf Date: Wed, 22 Nov 2023 10:41:02 +0700 Subject: [PATCH] revisi csrf trusted origin --- adventurers_inventory/settings.py | 1 + main/views.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/adventurers_inventory/settings.py b/adventurers_inventory/settings.py index 10e051e..dc7f1b1 100644 --- a/adventurers_inventory/settings.py +++ b/adventurers_inventory/settings.py @@ -77,6 +77,7 @@ WSGI_APPLICATION = 'adventurers_inventory.wsgi.application' +CSRF_TRUSTED_ORIGINS = ["https://daffa-mohamad-tugas.pbp.cs.ui.ac.id"] # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases diff --git a/main/views.py b/main/views.py index 1004ac3..e54041b 100644 --- a/main/views.py +++ b/main/views.py @@ -42,7 +42,6 @@ def create_item(request): context = {'form': form} return render(request, "create_item.html", context) -@csrf_exempt def register(request): form = UserCreationForm() @@ -55,7 +54,6 @@ def register(request): context = {'form':form} return render(request, 'register.html', context) -@csrf_exempt def login_user(request): if request.method == 'POST': username = request.POST.get('username')