Commit 8b48a444 by aagusti

redirect if no login

1 parent ae2b4259
...@@ -11,6 +11,10 @@ _logger = logging.getLogger(__name__) ...@@ -11,6 +11,10 @@ _logger = logging.getLogger(__name__)
class MyController(http.Controller): class MyController(http.Controller):
@http.route('/exam/title', type="http", auth="public", website=True) @http.route('/exam/title', type="http", auth="public", website=True)
def title_exam(self, **kwargs): def title_exam(self, **kwargs):
_logger.error(request.env.user)
if request.env.user.name == 'Public user':
return redirect("/web/login")
exams = \ exams = \
http.request.env['etq.exam'].sudo().search( http.request.env['etq.exam'].sudo().search(
[('active', '=', True)]) [('active', '=', True)])
......
...@@ -12,13 +12,12 @@ ...@@ -12,13 +12,12 @@
<template id="exam_title" name="Exam / Test / Quiz Titles"> <template id="exam_title" name="Exam / Test / Quiz Titles">
<t t-call="website.layout"> <t t-call="website.layout">
<h1 class="text-center">Silahkan pilih materi</h1>
<t t-foreach="exams" t-as="exam"> <t t-foreach="exams" t-as="exam">
<div class="mt16 mb16"> <div class="mt16 mb16">
<h1 class="text-center">
<t t-esc="exam.name"/>
</h1>
<h3 class="text-center"> <h3 class="text-center">
<a t-attf-href="/exam/#{exam.slug}">Mulai</a> <t t-esc="exam.name"/>
<a t-attf-href="/exam/#{exam.slug}"><i class="fa fa-arrow-right rounded-circle shadow-sm"/></a>
</h3> </h3>
</div> </div>
</t> </t>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!