huge updates i donot track what updates i have made

This commit is contained in:
sankalp committed 2025-03-29 03:22:47 +05:45
1 parent d02b470ca0
commit 84dd5d0b2f
55 files changed
+11072 -1415

No files matched your search

@@ -0,0 +1,555 @@
{% extends "admin/change_form.html" %}
{% load static %}
{% load mathfilters %}
{% block extrahead %}
{{ block.super }}
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<style>
#content {
width: auto !important;
padding: 0px !important;
max-width: auto !important;
}
.content {
padding: 0px !important;
margin: 0 !important;
}
.card {
margin: 0 !important;
border: none !important;
box-shadow: none !important;
background: transparent !important;
}
.filters-row {
background: #fff;
padding: 1rem;
border-radius: 4px;
margin-bottom: 1rem;
border: 1px solid #ddd;
}
.table {
background: white;
border: 1px solid #ddd;
width: 100%;
}
.select2-container {
width: 100% !important;
}
.card-header {
padding: 1rem;
margin-bottom: 0;
background-color: transparent;
border-bottom: 1px solid #ddd;
}
.card-title {
margin: 0;
font-size: 1.25rem;
font-weight: 400;
}
.card-body {
flex: 1 1 auto;
padding: 1rem;
}
.form-group {
margin-bottom: 1rem;
}
.form-control {
display: block;
width: 100%;
padding: .375rem .75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.select2-container--default .select2-selection--single {
height: calc(2.25rem + 2px);
padding: .375rem .75rem;
border: 1px solid #ced4da;
}
.table th,
.table td {
padding: .75rem;
vertical-align: middle;
border-top: 1px solid #dee2e6;
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #dee2e6;
background-color: #f4f6f9;
}
.btn {
display: inline-block;
font-weight: 400;
text-align: center;
vertical-align: middle;
user-select: none;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: .25rem;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.btn-primary {
color: #fff;
background-color: #007bff;
border-color: #007bff;
}
.btn-success {
color: #fff;
background-color: #28a745;
border-color: #28a745;
}
.remove-row-btn {
color: #dc3545;
cursor: pointer;
font-weight: bold;
}
.alert {
position: relative;
padding: .75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: .25rem;
}
.alert-success {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}
.alert-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
</style>
{% endblock %}
{% block content %}
<div class="card">
<div class="card-header">
<h3 class="card-title">Add Routines</h3>
</div>
<div class="card-body">
<form method="post" id="routine-form">
{% csrf_token %}
<div class="filters-row">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="id_course">Course</label>
<select name="course" id="id_course" class="form-control" required>
<option value="">Select Course</option>
{% for course in adminform.form.fields.course.queryset %}
{% if course.duration and course.duration_type %}
{% with total_semesters=course.duration|mul:2 %}
<option value="{{ course.id }}"
data-duration="{{ total_semesters }}"
data-duration-type="Semester">
{{ course.name }}
</option>
{% endwith %}
{% else %}
<option value="{{ course.id }}">{{ course.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="id_semester_or_year">Semester/Year</label>
<select name="semester_or_year" id="id_semester_or_year" class="form-control" required disabled>
<option value="">Select Course First</option>
</select>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table" id="routine-table">
<thead>
<tr>
<th>Subject</th>
<th>Teacher</th>
<th>Start Time</th>
<th>End Time</th>
<th style="width: 50px;">Action</th>
</tr>
</thead>
<tbody>
<tr class="routine-row">
<td colspan="5" class="text-center">
Please select course and semester
</td>
</tr>
</tbody>
</table>
</div>
<div class="row mt-3">
<div class="col-12">
<button type="submit" class="btn btn-primary float-right">
<i class="fas fa-save"></i> Save All Routines
</button>
</div>
</div>
</form>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const courseSelect = document.getElementById('id_course');
const semesterSelect = document.getElementById('id_semester_or_year');
const routineTable = document.getElementById('routine-table');
const addRowBtn = document.querySelector('.btn-add');
const form = document.getElementById('routine-form');
// Function to show status message
function showStatus(message, isError = false) {
const statusDiv = document.createElement('div');
statusDiv.className = `alert ${isError ? 'alert-danger' : 'alert-success'}`;
statusDiv.textContent = message;
// Insert at the top of the card body
const cardBody = document.querySelector('.card-body');
cardBody.insertBefore(statusDiv, cardBody.firstChild);
setTimeout(() => {
statusDiv.remove();
}, 5000);
}
// Function to update subject options
function updateSubjectOptions() {
const courseId = courseSelect.value;
const semester = semesterSelect.value;
const tbody = routineTable.querySelector('tbody');
if (courseId && semester) {
// Show loading state
tbody.innerHTML = `
<tr>
<td colspan="5" class="text-center">
<div>Loading subjects...</div>
</td>
</tr>
`;
fetch(`/app/get-subjects/?course_id=${courseId}&semester_or_year=${semester}`)
.then(response => response.json())
.then(data => {
if (data.subjects && data.subjects.length > 0) {
// Clear tbody
tbody.innerHTML = '';
// Create a row for each subject
data.subjects.forEach(subject => {
const row = document.createElement('tr');
row.className = 'routine-row';
row.innerHTML = `
<td>
<input type="hidden" name="subjects[]" value="${subject.id}">
<span>${subject.name}</span>
</td>
<td>
<select name="teachers[]" class="teacher-select" required>
<option value="">Select Teacher</option>
</select>
</td>
<td>
<input type="time" name="start_times[]" required>
</td>
<td>
<input type="time" name="end_times[]" required>
</td>
<td>
<span class="remove-row-btn">×</span>
</td>
`;
tbody.appendChild(row);
});
// Initialize teacher dropdowns
updateTeacherOptions();
// Initialize Select2 for new teacher dropdowns
$('.teacher-select').select2({
width: '100%'
});
} else {
tbody.innerHTML = `
<tr>
<td colspan="5" class="text-center">
<div>No subjects available for this semester</div>
</td>
</tr>
`;
}
})
.catch(error => {
console.error('Error fetching subjects:', error);
showStatus('Error loading subjects', true);
tbody.innerHTML = `
<tr>
<td colspan="5" class="text-center">
<div>Error loading subjects</div>
</td>
</tr>
`;
});
} else {
tbody.innerHTML = `
<tr class="routine-row">
<td colspan="5" class="text-center">
<div>Please select both course and semester</div>
</td>
</tr>
`;
}
}
// Function to update teacher options
function updateTeacherOptions() {
const teacherSelects = document.querySelectorAll('.teacher-select');
// Disable teacher selects while loading
teacherSelects.forEach(select => {
select.disabled = true;
select.innerHTML = '<option value="">Loading teachers...</option>';
});
fetch('/app/get-teachers/')
.then(response => response.json())
.then(data => {
if (data.success && data.teachers) {
teacherSelects.forEach(select => {
select.innerHTML = '<option value="">Select Teacher</option>';
data.teachers.forEach(teacher => {
select.innerHTML += `<option value="${teacher.id}">${teacher.name}</option>`;
});
select.disabled = false;
});
} else {
throw new Error('No teachers data returned');
}
})
.catch(error => {
console.error('Error loading teachers:', error);
showStatus('Error loading teachers', true);
teacherSelects.forEach(select => {
select.disabled = false;
select.innerHTML = '<option value="">Error loading teachers</option>';
});
});
}
// Function to update semester/year options based on course
function updateSemesterOptions() {
const selectedOption = courseSelect.options[courseSelect.selectedIndex];
console.log('Selected course:', selectedOption.text);
console.log('Duration:', selectedOption.dataset.duration);
console.log('Duration type:', selectedOption.dataset['duration-type']);
if (courseSelect.value) {
const totalSemesters = parseInt(selectedOption.dataset.duration) || 0;
console.log('Total semesters:', totalSemesters);
// Clear and update the semester select
semesterSelect.innerHTML = '<option value="">Select Semester</option>';
if (totalSemesters > 0) {
for (let i = 1; i <= totalSemesters; i++) {
const option = document.createElement('option');
option.value = i;
option.textContent = `Semester ${i}`;
semesterSelect.appendChild(option);
}
semesterSelect.disabled = false;
} else {
console.log('No valid duration found for course');
semesterSelect.disabled = true;
}
} else {
semesterSelect.innerHTML = '<option value="">Select Course First</option>';
semesterSelect.disabled = true;
}
// Initialize or update Select2
$(semesterSelect).select2({
width: '100%'
});
}
// Update subjects when course or semester changes
$(courseSelect).on('change', function() {
console.log('Course changed:', this.value);
updateSemesterOptions();
updateSubjectOptions();
});
$(semesterSelect).on('change', function() {
console.log('Semester changed:', this.value);
updateSubjectOptions();
});
// Event delegation for remove row button
$(routineTable).on('click', '.remove-row-btn', function() {
const row = $(this).closest('.routine-row');
if (confirm('Are you sure you want to remove this routine?')) {
row.remove();
if (routineTable.querySelector('tbody').children.length === 0) {
routineTable.querySelector('tbody').innerHTML = `
<tr class="routine-row">
<td colspan="5" class="text-center">
<div>All routines removed. Please select a course and semester to add more.</div>
</td>
</tr>
`;
}
}
});
// Remove the "Add Another Row" button since rows are auto-generated
if (addRowBtn) {
addRowBtn.style.display = 'none';
}
// Form submission
form.addEventListener('submit', function(e) {
e.preventDefault();
if (!courseSelect.value || !semesterSelect.value) {
showStatus('Please select both Course and Semester/Year', true);
return;
}
const routines = [];
// Get all routine rows
const routineRows = document.querySelectorAll('.routine-row');
routineRows.forEach(row => {
const subjectInput = row.querySelector('input[name="subjects[]"]');
const teacherSelect = row.querySelector('select[name="teachers[]"]');
const startTimeInput = row.querySelector('input[name="start_times[]"]');
const endTimeInput = row.querySelector('input[name="end_times[]"]');
if (subjectInput && teacherSelect && startTimeInput && endTimeInput) {
// Validate all required values are present
if (!subjectInput.value) {
showStatus('Subject is required for all rows', true);
return;
}
if (!teacherSelect.value) {
showStatus('Please select a teacher for all subjects', true);
return;
}
if (!startTimeInput.value) {
showStatus('Start time is required for all subjects', true);
return;
}
if (!endTimeInput.value) {
showStatus('End time is required for all subjects', true);
return;
}
// Validate time format
if (startTimeInput.value >= endTimeInput.value) {
showStatus('End time must be after start time', true);
return;
}
const routine = {
subject: subjectInput.value,
teacher: teacherSelect.value,
start_time: startTimeInput.value,
end_time: endTimeInput.value,
course: courseSelect.value,
semester_or_year: semesterSelect.value
};
console.log('Adding routine:', routine);
routines.push(routine);
}
});
if (routines.length === 0) {
showStatus('Please assign teachers and times for at least one subject', true);
return;
}
console.log('Sending routines data:', routines);
// Show loading state
showStatus('Saving routines...');
// Send data to server
fetch('{% url "admin:routine-add-multiple" %}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': '{{ csrf_token }}'
},
body: JSON.stringify({ routines: routines })
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('Server response:', data);
if (data.success) {
showStatus('Routines saved successfully');
// Clear form data
courseSelect.value = '';
semesterSelect.value = '';
routineTable.querySelector('tbody').innerHTML = '';
// Redirect after a short delay
setTimeout(() => {
window.location.href = '{% url "admin:app_routine_changelist" %}';
}, 1500);
} else {
showStatus('Error saving routines: ' + (data.message || 'Unknown error'), true);
}
})
.catch(error => {
console.error('Error:', error);
showStatus('Error saving routines. Please try again.', true);
});
});
});
</script>
{% endblock %}
+22
View File
@@ -0,0 +1,22 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Student Management System{% endblock %}</title>
<!-- Favicon -->
<link rel="shortcut icon" href="{% static 'favicon.ico' %}">
<!-- Base CSS -->
<link rel="stylesheet" href="{% static 'css/base.css' %}">
{% block extrastyle %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
{% block extrahead %}{% endblock %}
</body>
</html>
+786 -193
View File
File diff suppressed because it is too large. Load diff
+170
View File
@@ -0,0 +1,170 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Reset Password</h1>
<p>Enter your email address and we'll send you a verification code to reset your password.</p>
{% if error %}
<div class="error-message">
{{ error }}
</div>
{% endif %}
{% if success %}
<div class="success-message">
{{ success }}
</div>
{% endif %}
{% if messages %}
<div class="error-message">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
<form method="post" action="{% url 'email_reset_password' %}">
{% csrf_token %}
<div class="input-group">
<label for="email">Email Address</label>
<input type="email" name="email" id="email" required autofocus>
</div>
<button type="submit" class="submit-btn">Send Reset Code</button>
</form>
<a href="{% url 'reset_password_options' %}" class="back-link">← Back to Reset Options</a>
</div>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
margin: 20px auto;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 30px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="email"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 15px;
transition: border 0.3s;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
}
.back-link {
display: inline-block;
margin-top: 30px;
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link:hover {
text-decoration: underline;
}
.success-message {
color: var(--secondary-color);
margin-bottom: 20px;
padding: 10px;
background-color: rgba(52, 168, 83, 0.1);
border-radius: var(--border-radius);
text-align: left;
font-size: 14px;
}
</style>
{% endblock %}
@@ -0,0 +1,83 @@
{% autoescape off %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Reset</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.container {
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 5px;
padding: 25px;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.logo {
max-width: 100px;
margin-bottom: 15px;
}
h1 {
color: #4285f4;
font-size: 24px;
margin: 0;
}
.content {
margin-bottom: 30px;
}
.reset-code {
background-color: #f0f0f0;
padding: 15px;
border-radius: 4px;
text-align: center;
font-size: 24px;
font-weight: bold;
letter-spacing: 5px;
margin: 20px 0;
color: #4285f4;
}
.footer {
font-size: 12px;
color: #777;
text-align: center;
margin-top: 30px;
border-top: 1px solid #ddd;
padding-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Password Reset</h1>
</div>
<div class="content">
<p>Hello,</p>
<p>We received a request to reset your password for your Student Management System account. If you did not make this request, please ignore this email.</p>
<p>To reset your password, use the following code:</p>
<div class="reset-code">{{ reset_code }}</div>
<p>This code will expire in 5 minutes.</p>
<p>If you have any questions, please contact the system administrator.</p>
<p>Thank you,<br>Student Management System Team</p>
</div>
<div class="footer">
<p>This email was sent to you because someone requested a password reset for your account.</p>
<p>© {% now "Y" %} Student Management System. All rights reserved.</p>
</div>
</div>
</body>
</html>
{% endautoescape %}
@@ -0,0 +1 @@
Password Reset for Student Management System
+168
View File
@@ -0,0 +1,168 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.login-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
margin: 20px auto;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="text"],
input[type="password"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 16px;
transition: border 0.3s;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
padding: 10px;
background-color: rgba(234, 67, 53, 0.1);
border-radius: var(--border-radius);
}
.forgot-password {
margin-top: 20px;
text-align: right;
}
.forgot-password a {
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.forgot-password a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="login-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Login</h1>
{% if error %}
<div class="error-message">
{{ error }}
</div>
{% endif %}
{% if messages %}
<div class="error-message">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<div class="input-group">
<label for="username">Email or Phone Number</label>
<input type="text" name="username" id="username" required autofocus placeholder="Enter email or phone number">
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" name="password" id="password" required placeholder="Enter password">
</div>
<button type="submit" class="submit-btn">Login</button>
</form>
<div class="forgot-password">
<a href="{% url 'reset_password_options' %}">Forgot Password?</a>
</div>
</div>
</body>
</html>
{% endblock %}
@@ -0,0 +1,113 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Reset Complete - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 20px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.success-icon {
color: var(--secondary-color);
font-size: 48px;
margin-bottom: 20px;
}
.login-btn {
display: inline-block;
background-color: var(--primary-color);
color: white;
text-decoration: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
width: calc(100% - 48px);
text-align: center;
transition: background-color 0.3s;
margin-top: 20px;
}
.login-btn:hover {
background-color: #3367d6;
}
.success-box {
background-color: rgba(52, 168, 83, 0.1);
border-radius: var(--border-radius);
padding: 15px;
margin-bottom: 20px;
text-align: left;
border-left: 4px solid var(--secondary-color);
}
</style>
</head>
<body>
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Password Reset Complete</h1>
<div class="success-icon">✓</div>
<div class="success-box">
<p>Your password has been successfully reset.</p>
</div>
<p>You can now use your new password to log in to your account.</p>
<a href="{% url 'login' %}" class="login-btn">Log In</a>
</div>
</body>
</html>
{% endblock %}
+178
View File
@@ -0,0 +1,178 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Set New Password - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 30px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="password"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 15px;
transition: border 0.3s;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
}
.back-link {
display: inline-block;
margin-top: 30px;
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link:hover {
text-decoration: underline;
}
.alert-box {
background-color: rgba(234, 67, 53, 0.1);
border-radius: var(--border-radius);
padding: 15px;
margin-bottom: 20px;
text-align: left;
border-left: 4px solid var(--error-color);
}
</style>
</head>
<body>
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Set New Password</h1>
{% if validlink %}
<p>Please enter your new password below.</p>
{% if form.errors %}
<div class="error-message">
{% for field in form %}
{% for error in field.errors %}
{{ error }}<br>
{% endfor %}
{% endfor %}
</div>
{% endif %}
<form method="post">
{% csrf_token %}
<div class="input-group">
<label for="id_new_password1">New Password</label>
{{ form.new_password1 }}
</div>
<div class="input-group">
<label for="id_new_password2">Confirm New Password</label>
{{ form.new_password2 }}
</div>
<button type="submit" class="submit-btn">Change Password</button>
</form>
{% else %}
<div class="alert-box">
<p>The password reset link was invalid, possibly because it has already been used or has expired.</p>
</div>
<p>Please request a new password reset link.</p>
<a href="{% url 'reset_password_options' %}" class="back-link">Request New Reset Link</a>
{% endif %}
</div>
</body>
</html>
{% endblock %}
+107
View File
@@ -0,0 +1,107 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Reset Email Sent - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 20px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.success-icon {
color: var(--secondary-color);
font-size: 48px;
margin-bottom: 20px;
}
.back-link {
display: inline-block;
margin-top: 30px;
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link:hover {
text-decoration: underline;
}
.alert-box {
background-color: rgba(66, 133, 244, 0.1);
border-radius: var(--border-radius);
padding: 15px;
margin-bottom: 20px;
text-align: left;
border-left: 4px solid var(--primary-color);
}
</style>
</head>
<body>
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Email Sent</h1>
<div class="success-icon">✓</div>
<div class="alert-box">
<p>We've emailed you instructions for setting your password. You should receive them shortly.</p>
</div>
<p>If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder.</p>
<a href="{% url 'login' %}" class="back-link">← Return to Login</a>
</div>
</body>
</html>
{% endblock %}
+270
View File
@@ -0,0 +1,270 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verify OTP - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.otp-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
margin: 20px auto;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
.contact-info {
color: var(--text-color);
font-size: 15px;
margin-bottom: 25px;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.edit-btn {
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
padding: 4px 8px;
border: 1px solid var(--primary-color);
border-radius: 4px;
transition: all 0.3s;
}
.edit-btn:hover {
background-color: var(--primary-color);
color: white;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="text"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 18px;
transition: border 0.3s;
letter-spacing: 4px;
text-align: center;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.timer {
margin-top: 20px;
font-size: 14px;
color: var(--light-text);
}
.resend-btn {
background: transparent;
border: none;
color: var(--primary-color);
cursor: pointer;
font-size: 14px;
text-decoration: underline;
margin-left: 5px;
padding: 0;
}
.resend-btn:disabled {
color: var(--light-text);
text-decoration: none;
cursor: not-allowed;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
padding: 10px;
background-color: rgba(234, 67, 53, 0.1);
border-radius: var(--border-radius);
}
.back-link {
margin-top: 25px;
}
.back-link a {
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="otp-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Verify OTP</h1>
{% if is_email %}
<p class="contact-info">
Code sent to: {{ email|stringformat:"s"|slice:":3" }}***@{{ email|stringformat:"s"|slice:"-10:" }}
<a href="{% url 'email_reset_password' %}" class="edit-btn">Edit Email</a>
</p>
{% else %}
<p class="contact-info">
Code sent to: +91 ******{{ phone|stringformat:"s"|slice:"-4:" }}
<a href="{% url 'phone_reset_password' %}" class="edit-btn">Edit Number</a>
</p>
{% endif %}
{% if error %}
<div class="error-message">
{{ error }}
</div>
{% endif %}
{% if messages %}
<div class="error-message">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
{% if is_email %}
<form method="post" action="{% url 'password_reset_done' %}">
{% else %}
<form method="post" action="{% url 'verify_reset_otp' %}">
{% endif %}
{% csrf_token %}
<div class="input-group">
<label for="otp">Enter Verification Code</label>
<input type="text" name="otp" id="otp" maxlength="6" pattern="[0-9]{6}" required autofocus placeholder="Enter 6-digit code">
{% if is_email %}
<input type="hidden" name="email" value="{{ email }}">
{% else %}
<input type="hidden" name="phone" value="{{ phone }}">
{% endif %}
</div>
<button type="submit" class="submit-btn">Verify Code</button>
</form>
<div class="timer">
<span id="countdown">Resend code in <span id="timer">60</span>s</span>
{% if is_email %}
<form id="resendForm" method="post" action="{% url 'resend_reset_code' %}">
{% else %}
<form id="resendForm" method="post" action="{% url 'resend_phone_otp' %}">
{% endif %}
{% csrf_token %}
{% if is_email %}
<input type="hidden" name="email" value="{{ email }}">
{% else %}
<input type="hidden" name="phone" value="{{ phone }}">
{% endif %}
<button type="submit" class="resend-btn" id="resendBtn" disabled>Resend Code</button>
</form>
</div>
<div class="back-link">
<a href="{% url 'reset_password_options' %}">← Back to Reset Options</a>
</div>
</div>
<script>
// Countdown timer for resend code
let seconds = 60;
const timerSpan = document.getElementById('timer');
const resendBtn = document.getElementById('resendBtn');
const countdownText = document.getElementById('countdown');
function updateTimer() {
seconds--;
timerSpan.textContent = seconds;
if (seconds <= 0) {
clearInterval(timerInterval);
countdownText.textContent = '';
resendBtn.disabled = false;
}
}
const timerInterval = setInterval(updateTimer, 1000);
</script>
</body>
</html>
{% endblock %}
+197
View File
@@ -0,0 +1,197 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reset Password - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 30px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="email"],
input[type="tel"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 15px;
transition: border 0.3s;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.back-link {
margin-top: 25px;
}
.back-link a {
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link a:hover {
text-decoration: underline;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
}
.note {
font-size: 12px;
color: var(--light-text);
margin-top: 8px;
text-align: left;
}
.success-message {
color: var(--secondary-color);
margin-bottom: 20px;
padding: 10px;
background-color: rgba(52, 168, 83, 0.1);
border-radius: var(--border-radius);
text-align: left;
font-size: 14px;
}
</style>
</head>
<body>
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Reset Password</h1>
{% if is_email %}
<p>Enter your email address and we'll send you a verification code to reset your password.</p>
{% else %}
<p>Enter your phone number and we'll send you a verification code to reset your password.</p>
{% endif %}
{% if error %}
<div class="error-message">
{{ error }}
</div>
{% endif %}
{% if success %}
<div class="success-message">
{{ success }}
</div>
{% endif %}
{% if messages %}
<div class="error-message">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
<form method="post">
{% csrf_token %}
<div class="input-group">
{% if is_email %}
<label for="email">Email Address</label>
<input type="email" name="email" id="email" required autofocus>
{% else %}
<label for="phone">Phone Number</label>
<input type="tel" name="phone" id="phone" required autofocus>
{% endif %}
</div>
<button type="submit" class="submit-btn">Send Verification Code</button>
</form>
<a href="{% url 'reset_password_options' %}" class="back-link">← Back to Reset Options</a>
</div>
</body>
</html>
{% endblock %}
+160
View File
@@ -0,0 +1,160 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Set New Password - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 30px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="password"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 15px;
transition: border 0.3s;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
}
</style>
</head>
<body>
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Set New Password</h1>
<p>Please enter your new password below.</p>
{% if error %}
<div class="error-message">
{{ error }}
</div>
{% endif %}
{% if messages %}
<div class="error-message">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
<form method="post" action="{% url 'set_new_password' %}">
{% csrf_token %}
<div class="input-group">
<label for="new_password1">New Password</label>
<input type="password" name="new_password1" id="new_password1" required autofocus>
</div>
<div class="input-group">
<label for="new_password2">Confirm New Password</label>
<input type="password" name="new_password2" id="new_password2" required>
</div>
{% if is_email %}
<input type="hidden" name="email" value="{{ email }}">
{% else %}
<input type="hidden" name="phone" value="{{ phone }}">
{% endif %}
<input type="hidden" name="token" value="{{ token }}">
<button type="submit" class="submit-btn">Set New Password</button>
</form>
</div>
</body>
</html>
{% endblock %}
+219
View File
@@ -0,0 +1,219 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verify OTP - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.otp-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 15px;
}
.phone-info {
color: var(--primary-color);
font-size: 16px;
margin-bottom: 30px;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: var(--light-text);
}
input[type="text"] {
width: calc(100% - 20px);
padding: 12px 10px;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 15px;
transition: border 0.3s;
letter-spacing: 4px;
text-align: center;
}
input:focus {
border: 1px solid var(--primary-color);
outline: none;
}
.submit-btn {
background-color: var(--primary-color);
color: white;
border: none;
border-radius: var(--border-radius);
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
margin-top: 10px;
}
.submit-btn:hover {
background-color: #3367d6;
}
.back-link {
margin-top: 25px;
}
.back-link a {
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link a:hover {
text-decoration: underline;
}
.error-message {
color: var(--error-color);
margin-bottom: 20px;
text-align: left;
font-size: 14px;
}
.timer {
margin-top: 15px;
font-size: 14px;
color: var(--light-text);
}
.resend-btn {
background: transparent;
border: none;
color: var(--primary-color);
cursor: pointer;
font-size: 14px;
text-decoration: underline;
margin-left: 5px;
}
.resend-btn:disabled {
color: var(--light-text);
text-decoration: none;
cursor: not-allowed;
}
</style>
</head>
<body>
<div class="otp-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Verify OTP</h1>
<p class="phone-info">OTP sent to: {{ phone }}</p>
{% if error %}
<div class="error-message">
{{ error }}
</div>
{% endif %}
{% if messages %}
<div class="error-message">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
<form method="post" action="{% url 'verify_reset_otp' %}">
{% csrf_token %}
<div class="input-group">
<label for="otp">Enter OTP</label>
<input type="text" name="otp" id="otp" maxlength="6" pattern="[0-9]{6}" required autofocus>
<input type="hidden" name="phone" value="{{ phone }}">
</div>
<button type="submit" class="submit-btn">Verify OTP</button>
<div class="timer">
<span id="countdown">Resend OTP in <span id="timer">60</span>s</span>
<form id="resendForm" method="post" action="{% url 'resend_reset_otp' %}" style="display: inline;">
{% csrf_token %}
<input type="hidden" name="phone" value="{{ phone }}">
<button type="submit" class="resend-btn" id="resendBtn" disabled>Resend OTP</button>
</form>
</div>
<div class="back-link">
<a href="{% url 'phone_reset_password' %}">Use another number</a>
</div>
</form>
</div>
<script>
// Countdown timer for resend OTP
let seconds = 60;
const timerSpan = document.getElementById('timer');
const resendBtn = document.getElementById('resendBtn');
const countdownText = document.getElementById('countdown');
function updateTimer() {
seconds--;
timerSpan.textContent = seconds;
if (seconds <= 0) {
clearInterval(timerInterval);
countdownText.textContent = '';
resendBtn.disabled = false;
}
}
const timerInterval = setInterval(updateTimer, 1000);
</script>
</body>
</html>
{% endblock %}
+156
View File
@@ -0,0 +1,156 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reset Password - Student Management System</title>
<style>
:root {
--primary-color: #4285f4;
--secondary-color: #34a853;
--accent-color: #ea4335;
--background-color: #f8f9fa;
--text-color: #202124;
--light-text: #5f6368;
--error-color: #ea4335;
--border-radius: 8px;
--box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-color);
}
.reset-container {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
width: 380px;
padding: 40px;
text-align: center;
}
.logo {
margin-bottom: 30px;
width: 80px;
height: 80px;
}
h1 {
font-size: 24px;
font-weight: 500;
margin-bottom: 20px;
}
p {
margin-bottom: 30px;
color: var(--light-text);
line-height: 1.5;
text-align: left;
}
.options {
display: flex;
flex-direction: column;
gap: 15px;
margin: 30px 0;
}
.option-btn {
display: flex;
align-items: center;
background-color: white;
border: 1px solid #ddd;
border-radius: var(--border-radius);
padding: 15px;
cursor: pointer;
transition: all 0.3s;
text-decoration: none;
color: var(--text-color);
}
.option-btn:hover {
border-color: var(--primary-color);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.option-icon {
font-size: 24px;
margin-right: 15px;
color: var(--primary-color);
}
.option-text {
text-align: left;
}
.option-text h3 {
margin: 0 0 5px 0;
font-size: 16px;
}
.option-text p {
margin: 0;
font-size: 14px;
color: var(--light-text);
}
.back-link {
margin-top: 25px;
}
.back-link a {
color: var(--primary-color);
text-decoration: none;
font-size: 14px;
}
.back-link a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="reset-container">
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
<h1>Reset Password</h1>
<p>Select how you would like to reset your password:</p>
<div class="options">
<a href="{% url 'phone_reset_password' %}" class="option-btn">
<div class="option-icon">📱</div>
<div class="option-text">
<h3>Reset via SMS</h3>
<p>Receive a verification code on your phone number</p>
</div>
</a>
<a href="{% url 'email_reset_password' %}" class="option-btn">
<div class="option-icon">✉️</div>
<div class="option-text">
<h3>Reset via Email</h3>
<p>Receive a reset link on your email address</p>
</div>
</a>
</div>
<div class="back-link">
<a href="{% url 'login' %}">Back to login</a>
</div>
</div>
</body>
</html>
{% endblock %}
+61
View File
@@ -0,0 +1,61 @@
{% extends 'base.html' %}
{% block content %}
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h3 class="text-center">Reset Password</h3>
</div>
<div class="card-body">
{% if message %}
<div class="alert alert-info">{{ message }}</div>
{% endif %}
{% if error %}
<div class="alert alert-danger">{{ error }}</div>
{% endif %}
<form method="post">
{% csrf_token %}
<div class="form-group mb-3">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" name="email" value="{{ email }}" readonly>
</div>
<div class="form-group mb-3">
<label for="code">Reset Code</label>
<input type="text" class="form-control" id="code" name="code" required placeholder="Enter 6-digit code" maxlength="6" pattern="\d{6}">
<small class="form-text text-muted">
Enter the 6-digit code sent to your email.
</small>
</div>
<div class="form-group mb-3">
<label for="new_password1">New Password</label>
<input type="password" class="form-control" id="new_password1" name="new_password1" required>
<small class="form-text text-muted">
Your password must contain at least 8 characters.
</small>
</div>
<div class="form-group mb-3">
<label for="new_password2">Confirm New Password</label>
<input type="password" class="form-control" id="new_password2" name="new_password2" required>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">Reset Password</button>
</div>
</form>
<div class="text-center mt-3">
<p>Didn't receive the code? <a href="{% url 'password_reset' %}">Request a new one</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
File diff suppressed because it is too large. Load diff
+254
View File
@@ -0,0 +1,254 @@
{% extends 'base.html' %}
{% load static %}
{% load app_filters %}
{% block extrastyle %}
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
rel="stylesheet" />
<style>
/* Custom styling */
.content-card {
background: white;
border-radius: 1rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
padding: 1.5rem;
margin-bottom: 1.5rem;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.content-card:hover {
transform: translateY(-2px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.routine-card {
cursor: pointer;
position: relative;
transition: all 0.2s ease;
}
.routine-card:hover {
background-color: #f8f9fa;
}
.routine-card.active {
background-color: #e7f1ff;
border-left: 4px solid #4F46E5;
}
.student-list {
max-height: 500px;
overflow-y: auto;
}
.table th {
position: sticky;
top: 0;
background-color: #fff;
z-index: 10;
}
.custom-control {
padding-left: 1.5rem;
}
.header-flex {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
</style>
{% endblock %}
{% block content %}
<div class="container-fluid py-4">
<!-- Header -->
<div class="header-flex">
<h2 class="mb-0">Manage Attendance</h2>
<a href="{% url 'teacherDashboard' %}" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left me-2"></i> Back to Dashboard
</a>
</div>
<div class="row">
<!-- Routines Sidebar -->
<div class="col-md-3">
<div class="content-card">
<h5 class="mb-3">Your Routines</h5>
{% if routines %}
<div class="list-group">
{% for routine in routines %}
<a href="{% url 'manage_attendance_routine' routine.id %}"
class="list-group-item list-group-item-action routine-card {% if selected_routine.id == routine.id %}active{% endif %}">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1">{{ routine.subject.name }}</h6>
</div>
<p class="mb-1 small">{{ routine.course.name }} - Semester {{ routine.semester_or_year }}</p>
<div class="d-flex justify-content-between align-items-center">
<span class="badge bg-info text-white">
{{ routine.start_time|time:"g:i A" }} - {{ routine.end_time|time:"g:i A" }}
</span>
</div>
</a>
{% endfor %}
</div>
{% else %}
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i> You don't have any active routines.
</div>
{% endif %}
</div>
</div>
<!-- Attendance Form -->
<div class="col-md-9">
<div class="content-card">
{% if selected_routine %}
<div class="header-flex">
<div>
<h5 class="mb-1">{{ selected_routine.subject.name }}</h5>
<p class="text-muted mb-0">{{ selected_routine.course.name }} - Semester {{ selected_routine.semester_or_year }}</p>
</div>
<div>
<form class="d-flex align-items-center"
method="get"
action="{% url 'manage_attendance_routine' selected_routine.id %}">
<label for="datePicker" class="me-2">Date:</label>
<input type="date"
id="datePicker"
name="date"
class="form-control form-control-sm"
value="{{ selected_date|date:'Y-m-d' }}"
max="{{ today|date:'Y-m-d' }}">
<button type="submit" class="btn btn-sm btn-primary ms-2">
<i class="fas fa-calendar-check me-1"></i> View
</button>
</form>
</div>
</div>
<hr>
<!-- Attendance Form -->
<form method="post" action="/app/save-attendance/" id="attendanceForm">
{% csrf_token %}
<input type="hidden" name="routine_id" value="{{ selected_routine.id }}">
<input type="hidden" name="date" value="{{ selected_date|date:'Y-m-d' }}">
<div class="mb-3">
<div class="form-check form-switch">
<input class="form-check-input"
type="checkbox"
id="teacherAttend"
name="teacher_attend"
{% if attendance_data.teacher_attend %}checked{% endif %}>
<label class="form-check-label" for="teacherAttend">Teacher Present</label>
</div>
</div>
<div class="mb-3">
<label for="classStatus" class="form-label">Class Status</label>
<select class="form-select" id="classStatus" name="class_status">
<option value="True"
{% if attendance_data.class_status == True %}selected{% endif %}>
Conducted
</option>
<option value="False"
{% if attendance_data.class_status == False %}selected{% endif %}>
Not Conducted
</option>
</select>
</div>
<!-- Student Attendance -->
<h6 class="mb-3">Student Attendance</h6>
{% if students %}
<div class="student-list">
<table class="table table-hover">
<thead>
<tr>
<th width="5%">#</th>
<th width="40%">Name</th>
<th width="40%">Roll/ID</th>
<th width="15%">Present</th>
</tr>
</thead>
<tbody>
{% for student in students %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ student.name }}</td>
<td>{{ student.roll_no|default:student.id }}</td>
<td>
<div class="form-check">
<input class="form-check-input"
type="checkbox"
id="student_{{ student.id }}"
name="student_{{ student.id }}"
{% if attendance_data.records and attendance_data.records|get_item:student.id %}checked{% endif %}>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="mt-3 d-flex justify-content-between">
<div>
<button type="button" class="btn btn-outline-success me-2" id="selectAllBtn">
<i class="fas fa-check-double me-1"></i> Mark All Present
</button>
<button type="button" class="btn btn-outline-danger" id="deselectAllBtn">
<i class="fas fa-times-circle me-1"></i> Mark All Absent
</button>
</div>
<button type="submit" class="btn btn-primary">
<i class="fas fa-save me-1"></i> Save Attendance
</button>
</div>
{% else %}
<div class="alert alert-warning">
<i class="fas fa-exclamation-triangle me-2"></i> No students found for this course and semester.
</div>
{% endif %}
</form>
{% else %}
<div class="text-center py-5">
<i class="fas fa-chalkboard-teacher fa-4x text-muted mb-3"></i>
<h5>Select a routine to manage attendance</h5>
<p class="text-muted">Choose a class from the list on the left to take attendance.</p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block extrahead %}
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Select/Deselect all buttons
const selectAllBtn = document.getElementById('selectAllBtn');
const deselectAllBtn = document.getElementById('deselectAllBtn');
if (selectAllBtn) {
selectAllBtn.addEventListener('click', function() {
document.querySelectorAll('input[name^="student_"]').forEach(checkbox => {
checkbox.checked = true;
});
});
}
if (deselectAllBtn) {
deselectAllBtn.addEventListener('click', function() {
document.querySelectorAll('input[name^="student_"]').forEach(checkbox => {
checkbox.checked = false;
});
});
}
// Date change handler
const datePicker = document.getElementById('datePicker');
if (datePicker) {
datePicker.max = new Date().toISOString().split('T')[0]; // Set max date to today
}
});
</script>
{% endblock %}
File diff suppressed because it is too large. Load diff