HH/templates/accounts/change_password.html
2026-01-13 18:05:54 +03:00

381 lines
13 KiB
HTML

{% load i18n %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{% trans "Change Password - PX360" %}</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
<style>
:root {
--primary: #0086d2;
--primary-dark: #005d93;
--bg-gradient-start: #667eea;
--bg-gradient-end: #764ba2;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.password-container {
width: 100%;
max-width: 420px;
padding: 1.5rem;
}
.password-card {
background: white;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
overflow: hidden;
}
.password-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: white;
padding: 2rem 1.5rem;
text-align: center;
}
.password-header h3 {
margin-bottom: 0.5rem;
font-weight: 700;
}
.password-header p {
margin-bottom: 0;
opacity: 0.9;
font-size: 0.9rem;
}
.password-body {
padding: 2rem 1.5rem;
}
.form-control {
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 0.75rem 1rem;
font-size: 0.95rem;
}
.form-control:focus {
border-color: var(--primary);
box-shadow: 0 0 0 0.2rem rgba(0, 134, 210, 0.15);
}
.btn-change {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
border: none;
color: white;
font-weight: 600;
padding: 0.75rem;
border-radius: 8px;
transition: all 0.3s ease;
}
.btn-change:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 134, 210, 0.3);
color: white;
}
.btn-change:focus {
box-shadow: 0 0 0 0.2rem rgba(0, 134, 210, 0.15);
}
.input-group-text {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px 0 0 8px;
}
.input-group .form-control {
border-radius: 0 8px 8px 0;
border-left: none;
}
.input-group .form-control:focus {
border-left: none;
}
.password-toggle {
cursor: pointer;
border: none;
background: transparent;
padding: 0.75rem 1rem;
}
.password-toggle:hover {
background: #e9ecef;
}
.password-toggle:focus {
outline: none;
box-shadow: none;
}
.input-group-append {
border-radius: 0 8px 8px 0;
border-left: none;
background: #f8f9fa;
border: 1px solid #dee2e6;
}
.input-group-append:focus-within {
border-color: var(--primary);
background: #f8f9fa;
}
.password-footer {
padding: 1rem 1.5rem;
background: #f8f9fa;
text-align: center;
font-size: 0.85rem;
color: #6c757d;
}
.password-footer a {
color: var(--primary);
text-decoration: none;
}
.password-footer a:hover {
text-decoration: underline;
}
.alert {
border-radius: 8px;
border: none;
}
.help-text {
font-size: 0.8rem;
color: #6c757d;
margin-top: 0.25rem;
}
.password-requirements {
font-size: 0.8rem;
color: #6c757d;
background: #f8f9fa;
padding: 0.75rem;
border-radius: 8px;
margin-bottom: 1rem;
}
.password-requirements ul {
margin-bottom: 0;
padding-left: 1.5rem;
}
.password-requirements li {
margin-bottom: 0.25rem;
}
/* Responsive */
@media (max-width: 576px) {
.password-container {
padding: 1rem;
}
.password-header {
padding: 1.5rem 1rem;
}
.password-body {
padding: 1.5rem 1rem;
}
}
</style>
</head>
<body>
<div class="password-container">
<div class="password-card">
<!-- Header -->
<div class="password-header">
<div class="mb-3">
<i class="bi bi-shield-lock" style="font-size: 2.5rem;"></i>
</div>
<h3>{% trans "Change Password" %}</h3>
<p>{% trans "Secure your account with a new password" %}</p>
</div>
<!-- Body -->
<div class="password-body">
<!-- Messages -->
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
{% endif %}
<!-- Password Requirements -->
<div class="password-requirements">
<strong>{% trans "Password Requirements:" %}</strong>
<ul>
<li>{% trans "Minimum 8 characters" %}</li>
<li>{% trans "Cannot be too common" %}</li>
<li>{% trans "Cannot be entirely numeric" %}</li>
<li>{% trans "Must be different from your current password" %}</li>
</ul>
</div>
<!-- Change Password Form -->
<form method="post">
{% csrf_token %}
<!-- New Password -->
<div class="mb-3">
<label for="id_new_password1" class="form-label fw-semibold">
<i class="bi bi-key me-1"></i> {% trans "New Password" %}
</label>
<div class="input-group">
<span class="input-group-text">
<i class="bi bi-lock"></i>
</span>
<input type="password"
class="form-control"
id="id_new_password1"
name="new_password1"
placeholder="{% trans 'Enter new password' %}"
required
autofocus>
<button type="button"
class="password-toggle"
id="togglePassword1"
aria-label="Toggle password visibility">
<i class="bi bi-eye" id="toggleIcon1"></i>
</button>
</div>
{% if form.new_password1.help_text %}
<div class="help-text">{{ form.new_password1.help_text }}</div>
{% endif %}
{% if form.new_password1.errors %}
<div class="text-danger small mt-1">
{% for error in form.new_password1.errors %}
{{ error }}
{% endfor %}
</div>
{% endif %}
</div>
<!-- Confirm New Password -->
<div class="mb-4">
<label for="id_new_password2" class="form-label fw-semibold">
<i class="bi bi-check-circle me-1"></i> {% trans "Confirm New Password" %}
</label>
<div class="input-group">
<span class="input-group-text">
<i class="bi bi-lock-fill"></i>
</span>
<input type="password"
class="form-control"
id="id_new_password2"
name="new_password2"
placeholder="{% trans 'Confirm new password' %}"
required>
<button type="button"
class="password-toggle"
id="togglePassword2"
aria-label="Toggle password visibility">
<i class="bi bi-eye" id="toggleIcon2"></i>
</button>
</div>
{% if form.new_password2.help_text %}
<div class="help-text">{{ form.new_password2.help_text }}</div>
{% endif %}
{% if form.new_password2.errors %}
<div class="text-danger small mt-1">
{% for error in form.new_password2.errors %}
{{ error }}
{% endfor %}
</div>
{% endif %}
</div>
<!-- Submit Button -->
<button type="submit" class="btn btn-change w-100">
<i class="bi bi-shield-check me-2"></i> {% trans "Change Password" %}
</button>
</form>
</div>
<!-- Footer -->
<div class="password-footer">
<a href="{{ redirect_url }}" class="text-decoration-none">
<i class="bi bi-arrow-left me-1"></i> {% trans "Back to Dashboard" %}
</a>
</div>
</div>
</div>
<!-- Bootstrap 5 JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<!-- Password Visibility Toggle -->
<script>
// Toggle first password field
document.getElementById('togglePassword1').addEventListener('click', function() {
const passwordInput = document.getElementById('id_new_password1');
const toggleIcon = document.getElementById('toggleIcon1');
// Toggle password visibility
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
toggleIcon.classList.remove('bi-eye');
toggleIcon.classList.add('bi-eye-slash');
} else {
passwordInput.type = 'password';
toggleIcon.classList.remove('bi-eye-slash');
toggleIcon.classList.add('bi-eye');
}
});
// Toggle second password field
document.getElementById('togglePassword2').addEventListener('click', function() {
const passwordInput = document.getElementById('id_new_password2');
const toggleIcon = document.getElementById('toggleIcon2');
// Toggle password visibility
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
toggleIcon.classList.remove('bi-eye');
toggleIcon.classList.add('bi-eye-slash');
} else {
passwordInput.type = 'password';
toggleIcon.classList.remove('bi-eye-slash');
toggleIcon.classList.add('bi-eye');
}
});
</script>
<!-- Auto-dismiss alerts after 5 seconds -->
<script>
setTimeout(function() {
const alerts = document.querySelectorAll('.alert');
alerts.forEach(alert => {
const bsAlert = new bootstrap.Alert(alert);
bsAlert.close();
});
}, 5000);
</script>
</body>
</html>