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 @@
<div class="row header">
<div class="col">
<h2 class="pageTitle">Permintaan materi!</h2>
{% if user %}
<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" >
{% csrf_token %}
<div class="col-6 form-group">
......
......@@ -393,8 +393,11 @@ class ReqMateriView(TemplateView):
template_name = "req_materi.html"
def dispatch(self, request, *args, **kwargs):
if not request.user.is_admin:
raise PermissionDenied(request)
if request.user.is_authenticated == False:
return HttpResponseRedirect("/login/")
#raise PermissionDenied(request)
# else if not request.user.is_admin:
# raise PermissionDenied(request)
return super(ReqMateriView, self).dispatch(request, *args, **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