mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-27 17:59:03 +01:00
- Introduced a new `cosmetic_context` processor to provide custom CSS data to templates. - Updated `settings.py` to include the new context processor. - Modified multiple HTML templates to utilize the `cosmetic` variable for dynamic CSS styling. - Enhanced user interface elements with improved styling and accessibility features, including ARIA labels for form controls.
438 lines
16 KiB
HTML
438 lines
16 KiB
HTML
{% extends "baseTemplate/index.html" %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "Change Email Password - CyberPanel" %}{% endblock %}
|
|
{% block content %}
|
|
|
|
{% load static %}
|
|
{% get_current_language as LANGUAGE_CODE %}
|
|
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
|
|
|
<style>
|
|
.modern-container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
}
|
|
|
|
.page-header {
|
|
text-align: center;
|
|
margin-bottom: 3rem;
|
|
animation: fadeInDown 0.5s ease-out;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 2.5rem;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #1e293b);
|
|
margin-bottom: 0.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.page-subtitle {
|
|
font-size: 1.125rem;
|
|
color: var(--text-secondary, #64748b);
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.main-card {
|
|
background: var(--bg-secondary, white);
|
|
border-radius: 16px;
|
|
box-shadow: 0 1px 3px var(--shadow-light, rgba(0,0,0,0.05)), 0 10px 40px var(--shadow-color, rgba(0,0,0,0.08));
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
overflow: hidden;
|
|
animation: fadeInUp 0.5s ease-out;
|
|
}
|
|
|
|
.card-header {
|
|
background: linear-gradient(135deg, var(--bg-hover, #f8f9ff) 0%, var(--bg-hover-light, #f0f1ff) 100%);
|
|
padding: 1.5rem 2rem;
|
|
border-bottom: 1px solid var(--border-color, #e8e9ff);
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: var(--text-primary, #1e293b);
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.card-body {
|
|
padding: 2rem;
|
|
}
|
|
|
|
.form-section {
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
font-weight: 500;
|
|
color: var(--text-primary, #1e293b);
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.form-control {
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 8px;
|
|
font-size: 0.875rem;
|
|
transition: all 0.3s ease;
|
|
background: var(--bg-secondary, #fff);
|
|
}
|
|
|
|
.form-control:focus {
|
|
outline: none;
|
|
border-color: var(--accent-color, #5b5fcf);
|
|
box-shadow: 0 0 0 3px rgba(91, 95, 207, 0.1);
|
|
}
|
|
|
|
.input-group {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
align-items: center;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: var(--accent-color, #5b5fcf);
|
|
color: var(--bg-secondary, white);
|
|
border: none;
|
|
padding: 0.75rem 2rem;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: var(--accent-hover, #4547a9);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px var(--accent-shadow, rgba(91, 95, 207, 0.4));
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: var(--bg-secondary, #fff);
|
|
color: var(--accent-color, #5b5fcf);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
border-color: var(--accent-color, #5b5fcf);
|
|
}
|
|
|
|
.alert {
|
|
padding: 1rem 1.5rem;
|
|
border-radius: 8px;
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
animation: slideInRight 0.3s ease-out;
|
|
}
|
|
|
|
.alert-success {
|
|
background: var(--success-bg, #d1fae5);
|
|
color: var(--success-text, #065f46);
|
|
border: 1px solid var(--success-border, #a7f3d0);
|
|
}
|
|
|
|
.alert-danger {
|
|
background: var(--danger-bg, #fee2e2);
|
|
color: var(--danger-text, #991b1b);
|
|
border: 1px solid var(--danger-border, #fecaca);
|
|
}
|
|
|
|
.alert-info {
|
|
background: var(--info-bg, #dbeafe);
|
|
color: var(--info-text, #1e40af);
|
|
border: 1px solid var(--info-border, #bfdbfe);
|
|
}
|
|
|
|
.disabled-notice {
|
|
background: var(--warning-bg, #fef3c7);
|
|
border: 1px solid var(--warning-border, #fde68a);
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.disabled-notice h3 {
|
|
color: var(--warning-text, #92400e);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.loading-spinner {
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid #e8e9ff;
|
|
border-top-color: var(--accent-color, #5b5fcf);
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
.password-section {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
.password-strength {
|
|
margin-top: 0.5rem;
|
|
height: 4px;
|
|
background: var(--bg-muted, #e5e7eb);
|
|
border-radius: 2px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.password-strength-bar {
|
|
height: 100%;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.strength-weak {
|
|
width: 33%;
|
|
background: var(--danger-color, #ef4444);
|
|
}
|
|
|
|
.strength-medium {
|
|
width: 66%;
|
|
background: var(--warning-color, #ffa000);
|
|
}
|
|
|
|
.strength-strong {
|
|
width: 100%;
|
|
background: var(--success-color, #10b981);
|
|
}
|
|
|
|
.security-notice {
|
|
background: var(--info-bg-light, #e0e7ff);
|
|
border: 1px solid var(--info-border-light, #c7d2fe);
|
|
border-radius: 8px;
|
|
padding: 1rem 1.5rem;
|
|
margin-bottom: 1.5rem;
|
|
font-size: 0.875rem;
|
|
color: var(--info-text-dark, #3730a3);
|
|
}
|
|
|
|
.security-notice i {
|
|
color: var(--accent-color, #5b5fcf);
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.password-hint {
|
|
color: var(--text-secondary, #64748b);
|
|
margin-top: 0.5rem;
|
|
display: block;
|
|
}
|
|
|
|
.action-section {
|
|
margin-top: 2rem;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
@keyframes fadeInUp {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
@keyframes fadeInDown {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
@keyframes slideInRight {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateX(20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<div class="modern-container" ng-controller="changeEmailPassword">
|
|
<div class="page-header">
|
|
<h1 class="page-title">
|
|
<i class="fas fa-key"></i>
|
|
{% trans "Change Email Password" %}
|
|
</h1>
|
|
<p class="page-subtitle">{% trans "Update the password for your email accounts securely" %}</p>
|
|
</div>
|
|
|
|
<div class="main-card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">
|
|
<i class="fas fa-lock"></i>
|
|
{% trans "Password Management" %}
|
|
<span ng-show="emailLoading" class="loading-spinner"></span>
|
|
</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
{% if not status %}
|
|
<div class="disabled-notice">
|
|
<i class="fas fa-exclamation-triangle fa-3x mb-3" style="color: var(--warning-color, #ffa000);"></i>
|
|
<h3>{% trans "Postfix is disabled" %}</h3>
|
|
<p class="mb-3">{% trans "You need to enable Postfix to manage email passwords" %}</p>
|
|
<a href="{% url 'managePostfix' %}" class="btn-primary">
|
|
<i class="fas fa-power-off"></i>
|
|
{% trans "Enable Postfix Now" %}
|
|
</a>
|
|
</div>
|
|
{% else %}
|
|
<form action="/" method="post">
|
|
<div class="form-section">
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Select Website" %}</label>
|
|
<select ng-change="showEmailDetails()" ng-model="emailDomain" class="form-control" aria-label="{% trans 'Select Website' %}">
|
|
<option value="">{% trans "Choose a website..." %}</option>
|
|
{% for items in websiteList %}
|
|
<option value="{{ items }}">{{ items }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div ng-hide="emailDetails" class="password-section">
|
|
<div class="security-notice">
|
|
<i class="fas fa-shield-alt"></i>
|
|
{% trans "Use a strong password with a mix of letters, numbers, and special characters for better security" %}
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Select Email Account" %}</label>
|
|
<select ng-model="selectedEmail" class="form-control" aria-label="{% trans 'Select Email Account' %}">
|
|
<option value="">{% trans "Choose an email account..." %}</option>
|
|
<option ng-repeat="email in emails track by $index" value="{$ email.email $}">{$ email.email $}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "New Password" %}</label>
|
|
<div class="input-group">
|
|
<input type="password" class="form-control" ng-model="emailPassword"
|
|
placeholder="{% trans 'Enter new password' %}" required>
|
|
<button type="button" ng-click="generatePassword()" class="btn-secondary">
|
|
<i class="fas fa-dice"></i>
|
|
{% trans "Generate" %}
|
|
</button>
|
|
</div>
|
|
<div class="password-strength" ng-show="emailPassword">
|
|
<div class="password-strength-bar"
|
|
ng-class="{'strength-weak': emailPassword.length < 8,
|
|
'strength-medium': emailPassword.length >= 8 && emailPassword.length < 12,
|
|
'strength-strong': emailPassword.length >= 12}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div ng-hide="generatedPasswordView" class="form-group">
|
|
<label class="form-label">{% trans "Generated Password" %}</label>
|
|
<div class="input-group">
|
|
<input type="text" name="email" class="form-control"
|
|
ng-model="emailPassword" readonly aria-label="{% trans 'Generated Password' %}">
|
|
<button type="button" ng-click="usePassword()" class="btn-secondary">
|
|
<i class="fas fa-check"></i>
|
|
{% trans "Use This Password" %}
|
|
</button>
|
|
</div>
|
|
<small class="password-hint">
|
|
<i class="fas fa-info-circle"></i>
|
|
{% trans "Make sure to save this password in a secure location" %}
|
|
</small>
|
|
</div>
|
|
|
|
<div class="action-section">
|
|
<button type="button" ng-click="changePassword()" class="btn-primary">
|
|
<i class="fas fa-save"></i>
|
|
{% trans "Change Password" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Alert Messages -->
|
|
<div class="form-section">
|
|
<div ng-hide="noEmails" class="alert alert-info">
|
|
<i class="fas fa-info-circle"></i>
|
|
{% trans "Currently no email accounts exist for this domain." %}
|
|
</div>
|
|
|
|
<div ng-hide="canNotChangePassword" class="alert alert-danger">
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
{% trans "Cannot change password. Error message:" %} {$ errorMessage $}
|
|
</div>
|
|
|
|
<div ng-hide="passwordChanged" class="alert alert-success">
|
|
<i class="fas fa-check-circle"></i>
|
|
{% trans "Password successfully changed for:" %} <strong>{$ passEmail $}</strong>
|
|
</div>
|
|
|
|
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
|
<i class="fas fa-times-circle"></i>
|
|
{% trans "Could not connect to server. Please refresh this page." %}
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|