Files
Student-Management-System-I…/templates/login/password_reset_otp.html
T

270 lines
7.8 KiB
HTML

{% 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 %}