1 2<!DOCTYPE html> 3<html lang="en"> 4 5<head> 6 <meta charset="UTF-8"> 7 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 8 <title>Department Login | QUEST Nawabshah</title> 9 10 <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> 11 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css"> 12
12<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
12 13 <link rel="stylesheet" href="/static/secure_dashboard/css/dashboard_styles.css"> 14 <link rel="shortcut icon" href="/static/images/logo/logo-color-filled.png" type="image/x-icon" /> 15 <style> 16 body, html { margin: 0; padding: 0; height: 100%; background: #f8f9fa; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } 17 .login-container { height: 100%; display: flex; justify-content: center; align-items: center; } 18 .login-card { width: 100%; max-width: 400px; border: none; border-radius: 8px; } 19 .logo-area img { width: 100px; height: auto; } 20 #loadingOverlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.4); justify-content: center; align-items: center; z-index: 9999; } 21 #loadingOverlay .spinner-border { width: 3rem; height: 3rem; } 22 .eye-icon { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); cursor: pointer; font-size: 18px; color: gray; } 23 </style> 24</head> 25 26<body> 27 <div id="loadingOverlay"> 28 <div class="spinner-border text-light" role="status"> 29 <span class="visually-hidden">Loading...</span> 30 </div> 31 </div> 32 33 <div class="container login-container"> 34 <div class="card login-card shadow-sm p-4"> 35 36 <div class="text-center mb-3 logo-area"> 37 <img src="/static/images/logo/logo-color.png" alt="University Logo" class="mb-2"> 38 <h4 class="mb-0">Quaid e Awam University</h4> 39 </div> 40 41 <h5 class="text-center mb-3">Department Login</h5> 42 43 <form id="departmentLoginForm"> 44 <input type="hidden" name="csrfmiddlewaretoken" value="7u0E8P91BavF9XpjppMWWQKaALxIpq5N0huvoQoEgIHWGvHJow1dpMkkvgu4BeNc"> 45 46 <div class="mb-3"> 47 <label for="email" class="form-label">Email</label> 48 <input type="email" name="email" id="email" class="form-control" required autofocus> 49 </div> 50 51 <div class="mb-3"> 52 <label for="password" class="form-label">Password</label> 53 <div class="position-relative"> 54 <input type="password" name="password" id="password" class="form-control pr-5" placeholder="Password" required> 55 <i class="bi bi-eye position-absolute eye-icon" id="togglePassword"></i> 56 </div> 57 </div> 58 59 <div class="d-flex justify-content-between align-items-center mb-3"> 60 <div class="form-check"> 61 <input class="form-check-input" type="checkbox" value="" id="rememberMe"> 62 <label class="form-check-label" for="rememberMe">Remember me</label> 63 </div> 64 </div> 65 66 <button type="submit" class="btn btn-primary w-100">Login</button> 67 </form> 68 69 <div id="loginMessage" class="mt-3"></div> 70 71 <div class="text-center mt-4 small text-muted"> 72 <p class="mb-1">© 2025 Quaid e Awam University</p> 73 <div> 74 <a href="#" class="text-muted me-2"><i class="bi bi-facebook fs-5"></i></a> 75 <a href="#" class="text-muted me-2"><i class="bi bi-twitter fs-5"></i></a> 76 <a href="#" class="text-muted me-2"><i class="bi bi-linkedin fs-5"></i></a> 77 <a href="#" class="text-muted"><i class="bi bi-youtube fs-5"></i></a> 78 </div> 79 </div> 80 </div> 81 </div> 82 83 <div id="centeredAlert" class="centered-alert"></div> 84
84<script src="/static/js/teachers.js"></script>
84 85
85<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
85 86 87
87<script> 88 // --- 1. CRITICAL SECURITY FIX: Fetch Token from HTML (Not Cookie) --- 89 function getCsrfToken() { 90 return document.querySelector('[name=csrfmiddlewaretoken]').value; 91 } 92 93 $.ajaxSetup({ 94 beforeSend: function(xhr, settings) { 95 if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) { 96 xhr.setRequestHeader("X-CSRFToken", getCsrfToken()); 97 } 98 } 99 }); 100 // -------------------------------------------------- 101 102 $(function () { 103 $('#departmentLoginForm').on('submit', function (e) { 104 e.preventDefault(); 105 $('#loadingOverlay').css('display', 'flex'); 106 107 const email = $('#email').val(); 108 const password = $('#password').val(); 109 110 $.ajax({ 111 url: "/secure-dashboard/department_login/", 112 method: "POST", 113 contentType: "application/json", 114 data: JSON.stringify({ 115 email: email, 116 password: password 117 }), 118 success: function (resp) { 119 $('#loadingOverlay').hide(); 120 if (resp.success) { 121 window.location.href = resp.redirect; 122 } else { 123 if (typeof showAlert === "function") { 124 showAlert(resp.message, 'danger'); 125 } else { 126 alert(resp.message); 127 } 128 } 129 }, 130 error: function (xhr) { 131 $('#loadingOverlay').hide(); 132 let msg = 'Error logging in'; 133 if (xhr.responseJSON && xhr.responseJSON.message) { 134 msg = xhr.responseJSON.message; 135 } 136 if (typeof showAlert === "function") { 137 showAlert(msg, 'danger'); 138 } else { 139 alert(msg); 140 } 141 } 142 }); 143 }); 144 145 // Toggle Password 146 $("#togglePassword").click(function () { 147 let passwordField = $("#password"); 148 let icon = $(this); 149 if (passwordField.attr("type") === "password") { 150 passwordField.attr("type", "text"); 151 icon.removeClass("bi-eye").addClass("bi-eye-slash"); 152 } else { 153 passwordField.attr("type", "password"); 154 icon.removeClass("bi-eye-slash").addClass("bi-eye"); 155 } 156 }); 157 }); 158 </script>
158 159</body> 160</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.