295 lines
9.3 KiB
HTML
295 lines
9.3 KiB
HTML
{% extends "shared/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>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--primary-color: #4f46e5;
|
|
--primary-hover: #4338ca;
|
|
--secondary-color: #10b981;
|
|
--accent-color: #f43f5e;
|
|
--background-color: #f8fafc;
|
|
--text-color: #1e293b;
|
|
--light-text: #64748b;
|
|
--error-color: #ef4444;
|
|
--success-color: #10b981;
|
|
--border-radius: 12px;
|
|
--box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
--transition: all 0.3s ease;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Inter', sans-serif;
|
|
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.login-container {
|
|
background: rgba(255, 255, 255, 0.95);
|
|
backdrop-filter: blur(10px);
|
|
border-radius: var(--border-radius);
|
|
box-shadow: var(--box-shadow);
|
|
width: 420px;
|
|
padding: 2.5rem;
|
|
text-align: center;
|
|
margin: 20px;
|
|
transform: translateY(0);
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.login-container:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.logo {
|
|
margin-bottom: 2rem;
|
|
width: 90px;
|
|
height: 90px;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.logo:hover {
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
h1 {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
margin-bottom: 1.5rem;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.input-group {
|
|
margin-bottom: 1.5rem;
|
|
text-align: left;
|
|
position: relative;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
color: var(--light-text);
|
|
}
|
|
|
|
input[type="text"],
|
|
input[type="password"] {
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border: 2px solid #e2e8f0;
|
|
border-radius: var(--border-radius);
|
|
font-size: 0.875rem;
|
|
line-height: 1.25rem;
|
|
transition: var(--transition);
|
|
box-sizing: border-box;
|
|
background-color: #f8fafc;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
height: 42px;
|
|
}
|
|
|
|
input:focus {
|
|
border-color: var(--primary-color);
|
|
outline: none;
|
|
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
|
|
background-color: white;
|
|
}
|
|
|
|
.password-toggle {
|
|
position: absolute;
|
|
right: 1rem;
|
|
top: 50%;
|
|
transform: translateY(25%);
|
|
cursor: pointer;
|
|
color: var(--light-text);
|
|
background: none;
|
|
border: none;
|
|
padding: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 20px;
|
|
height: 20px;
|
|
transition: var(--transition);
|
|
pointer-events: auto;
|
|
}
|
|
|
|
.password-toggle:hover {
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.password-toggle i {
|
|
font-size: 0.875rem;
|
|
line-height: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.submit-btn {
|
|
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: var(--border-radius);
|
|
padding: 0.875rem 1.5rem;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
width: 100%;
|
|
transition: var(--transition);
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
.submit-btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
|
|
}
|
|
|
|
.error-message {
|
|
color: var(--error-color);
|
|
margin-bottom: 1.5rem;
|
|
text-align: left;
|
|
font-size: 0.875rem;
|
|
padding: 0.75rem;
|
|
background-color: rgba(239, 68, 68, 0.1);
|
|
border-radius: var(--border-radius);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
border-left: 3px solid var(--error-color);
|
|
}
|
|
|
|
.error-message i {
|
|
color: var(--error-color);
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.forgot-password {
|
|
margin-top: 1.5rem;
|
|
text-align: right;
|
|
}
|
|
|
|
.forgot-password a {
|
|
color: var(--primary-color);
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.forgot-password a:hover {
|
|
color: var(--primary-hover);
|
|
text-decoration: underline;
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.login-container {
|
|
width: 90%;
|
|
padding: 1.5rem;
|
|
margin: 1rem;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-container">
|
|
{% if institute and institute.logo %}
|
|
<img src="{{ institute.logo.url }}" alt="{{ institute.name }} Logo" class="logo">
|
|
{% else %}
|
|
<img src="{% static 'img/logo.png' %}" alt="Logo" class="logo">
|
|
{% endif %}
|
|
<h1>Welcome Back</h1>
|
|
|
|
{% if error %}
|
|
<div class="error-message">
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
Invalid credentials. Please check your email/phone and password.
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if messages %}
|
|
<div class="error-message">
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
{% 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">
|
|
<button type="button" class="password-toggle" id="togglePassword">
|
|
<i class="fas fa-eye"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<input type="hidden" name="next" value="{{ next|default:'/app/dashboard/' }}">
|
|
|
|
<button type="submit" class="submit-btn">Sign In</button>
|
|
</form>
|
|
|
|
<div class="forgot-password">
|
|
<a href="{% url 'reset_password_options' %}">Forgot Password?</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const togglePassword = document.getElementById('togglePassword');
|
|
const password = document.getElementById('password');
|
|
|
|
togglePassword.addEventListener('click', function() {
|
|
const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
|
|
password.setAttribute('type', type);
|
|
|
|
const icon = this.querySelector('i');
|
|
icon.classList.toggle('fa-eye');
|
|
icon.classList.toggle('fa-eye-slash');
|
|
});
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const form = document.querySelector('form');
|
|
const usernameInput = document.getElementById('username');
|
|
|
|
form.addEventListener('submit', function(event) {
|
|
const value = usernameInput.value.trim();
|
|
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
const phonePattern = /^\d{10}$/;
|
|
|
|
if (!emailPattern.test(value) && !phonePattern.test(value)) {
|
|
event.preventDefault();
|
|
alert('Please enter a valid email address or a 10-digit phone number.');
|
|
usernameInput.focus();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
{% endblock %} |