You need to sign in or sign up before continuing.
Commit e6502376 authored by Samarth Joshi's avatar Samarth Joshi

Added cheating prevention measures

parent 48f3dc07
No preview for this file type
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
#timer { #timer {
font-size: 2em; font-size: 2em;
text-align: center; text-align: center;
position: relative;
} }
/* ----- Quiz Pallete Start ----- */ /* ----- Quiz Pallete Start ----- */
...@@ -238,3 +239,51 @@ ...@@ -238,3 +239,51 @@
padding: 20px; padding: 20px;
} }
#forcefs {
background-color: white;
width: 100%;
height: 100%;
position: fixed;
top:0;
left:0;
z-index:3000;
text-align:center;
}
.flexwrap {
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
flex-direction: column;
font-size: 1.5em;
}
#initial_screen {
background-color: white;
width: 100%;
height: 100%;
position: fixed;
top:0;
left:0;
z-index:3001;
text-align:center;
}
.instructions_list {
text-align: left;
max-width: 600px;
}
#agree_btn {
width: 150px;
height: 60px;
font-size: 1em;
border-radius: 4px;
background: linear-gradient(to right, rgb(101, 153, 153), rgb(244, 121, 31));
border: none;
font-weight: bold;
color: white;
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 24h-6.55c-1.08 0-2.14-.45-2.89-1.23l-7.3-7.61 2.07-1.83c.62-.55 1.53-.66 2.26-.27L8 14.34V4.79c0-1.38 1.12-2.5 2.5-2.5.17 0 .34.02.51.05.09-1.3 1.17-2.33 2.49-2.33.86 0 1.61.43 2.06 1.09.29-.12.61-.18.94-.18 1.38 0 2.5 1.12 2.5 2.5v.28c.16-.03.33-.05.5-.05 1.38 0 2.5 1.12 2.5 2.5V20c0 2.21-1.79 4-4 4zM4.14 15.28l5.86 6.1c.38.39.9.62 1.44.62H18c1.1 0 2-.9 2-2V6.15c0-.28-.22-.5-.5-.5s-.5.22-.5.5V12h-2V3.42c0-.28-.22-.5-.5-.5s-.5.22-.5.5V12h-2V2.51c0-.28-.22-.5-.5-.5s-.5.22-.5.5V12h-2V4.79c0-.28-.22-.5-.5-.5s-.5.23-.5.5v12.87l-5.35-2.83-.51.45z"/></svg>
\ No newline at end of file
...@@ -5,8 +5,37 @@ ...@@ -5,8 +5,37 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<link href="{% static 'css/quiz_attempt_page.css' %}" rel="stylesheet"> <link href="{% static 'css/quiz_attempt_page.css' %}" rel="stylesheet">
<script>
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
document.onkeydown = function (e) {
return false;
}
document.addEventListener('contextmenu', event => event.preventDefault());
</script>
</head> </head>
<body> <body>
<section id="initial_screen">
<div class="flexwrap">
<h2>Please read following instructions carefully.</h2>
<ul class="instructions_list">
<li>The timer is set on the server side. When times runs out your quiz will be autosubmitted</li>
<li>Dont use keyboard while attempting Quiz.</li>
<li>Quiz will be in fullscreen to prevent accessing other tabs</li>
<li>Mouse right click is disabled</li>
<li>By clicking on I Agree you accept not to be part of malicious activities which may result in you submission being invalidated</li>
</ul>
<button type="button" id="agree_btn" onclick="launchFullScreen(document.documentElement)">I Agree</button>
</div>
</section>
<section id="forcefs"><div class="flexwrap"><img width="100px" height="100px" src="{% static 'img/stop.svg' %}"><br/><a onclick="launchFullScreen(document.documentElement)">Oops! You must be fullscreen to continue. <br/>Click here to launch fullscreen</a></div></section>
<form id="main_form" method="POST" action="/result/">{% csrf_token %} <form id="main_form" method="POST" action="/result/">{% csrf_token %}
<!-- <h1>{{questions.quizId}} Question {{ questions.end_index }} of {{count}}</h1> --> <!-- <h1>{{questions.quizId}} Question {{ questions.end_index }} of {{count}}</h1> -->
<aside id="question_palette"> <aside id="question_palette">
...@@ -97,6 +126,20 @@ ...@@ -97,6 +126,20 @@
//submit_form(1); //submit_form(1);
} }
}, 1000); }, 1000);
var fsscreen = document.getElementById("forcefs");
var initscr = document.getElementById("initial_screen");
var checkfs = setInterval(function() {
if(document.fullscreenElement || document.webkitFullscreenElement ||
document.mozFullScreenElement) {
fsscreen.style.display = "none";
initscr.style.display = "none";
} else {
fsscreen.style.display = "block";
}
}, 1000);
</script> </script>
</body> </body>
</html> </html>
...@@ -2,11 +2,15 @@ ...@@ -2,11 +2,15 @@
<head> <head>
<title>Pariksha</title> <title>Pariksha</title>
<script>
function start_quiz() {
window.open("/quiz/?q=1", "_blank", "fullscreen=yes");
}
</script>
</head> </head>
<body> <body>
<center><h1><a>Welcome Student{{user}}</a></h1> <center><h1><a>Welcome Student{{user}}</a></h1>
<br><h1><a href="/quiz/?q=0">Start Quiz</a></h1> <br><h1><a onclick="start_quiz()">Start Quiz</a></h1>
<br><h1><a href="/submissions/">View Previous Quizzes</a></h1> <br><h1><a href="/submissions/">View Previous Quizzes</a></h1>
</body> </body>
</html> </html>
Markdown is supported
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