Fakultas Ilmu Komputer UI

Commit 6db72fd1 authored by insan ramadhan's avatar insan ramadhan
Browse files

check login session before submit request

parent 8f6204e8
Pipeline #57065 passed with stages
in 9 minutes and 33 seconds
...@@ -55,7 +55,11 @@ ...@@ -55,7 +55,11 @@
<div class="row header"> <div class="row header">
<div class="col"> <div class="col">
<h2 class="pageTitle">Permintaan materi!</h2> <h2 class="pageTitle">Permintaan materi!</h2>
{% if user %}
<p class="description">Tuliskan judul materi yang kamu mau</p> <p class="description">Tuliskan judul materi yang kamu mau</p>
{% else %}
<p class="description">Tuliskan judul materi yang kamu mau, anda harus login terlebih dahulu untuk melakukan permintaan</p>
{% endif %}
<form class="searchBar" > <form class="searchBar" >
{% csrf_token %} {% csrf_token %}
<div class="col-6 form-group"> <div class="col-6 form-group">
...@@ -393,8 +393,11 @@ class ReqMateriView(TemplateView): ...@@ -393,8 +393,11 @@ class ReqMateriView(TemplateView):
template_name = "req_materi.html" template_name = "req_materi.html"
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not request.user.is_admin: if request.user.is_authenticated == False:
raise PermissionDenied(request) return HttpResponseRedirect("/login/")
#raise PermissionDenied(request)
# else if not request.user.is_admin:
# raise PermissionDenied(request)
return super(ReqMateriView, self).dispatch(request, *args, **kwargs) return super(ReqMateriView, self).dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment