234 lines
7.0 KiB
HTML
234 lines
7.0 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">
|
|
<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;
|
|
position: relative;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 8px;
|
|
font-size: 14px;
|
|
color: var(--light-text);
|
|
}
|
|
|
|
input[type="text"],
|
|
input[type="password"] {
|
|
width: 100%;
|
|
padding: 12px 40px 12px 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: var(--border-radius);
|
|
font-size: 16px;
|
|
transition: border 0.3s;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
input:focus {
|
|
border: 1px solid var(--primary-color);
|
|
outline: none;
|
|
}
|
|
|
|
.password-toggle {
|
|
position: absolute;
|
|
right: 12px;
|
|
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: 24px;
|
|
height: 24px;
|
|
}
|
|
|
|
.password-toggle:hover {
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.password-toggle i {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.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);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.error-message i {
|
|
color: var(--error-color);
|
|
font-size: 16px;
|
|
}
|
|
|
|
.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">
|
|
{% 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>Login</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" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|[0-9]{10}" title="Please enter a valid email or 10-digit 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>
|
|
|
|
<!-- Add a hidden next field to ensure proper redirection -->
|
|
<input type="hidden" name="next" value="{{ next|default:'/app/dashboard/' }}">
|
|
|
|
<button type="submit" class="submit-btn">Login</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() {
|
|
// Toggle password visibility
|
|
const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
|
|
password.setAttribute('type', type);
|
|
|
|
// Toggle eye icon
|
|
const icon = this.querySelector('i');
|
|
icon.classList.toggle('fa-eye');
|
|
icon.classList.toggle('fa-eye-slash');
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
{% endblock %} |