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.
521 lines
20 KiB
HTML
521 lines
20 KiB
HTML
{% extends "baseTemplate/index.html" %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "Setup Email Forwarding - 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;
|
|
}
|
|
|
|
.docs-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem 1rem;
|
|
background: var(--bg-secondary, #fff);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 8px;
|
|
color: var(--accent-color, #5b5fcf);
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
transition: all 0.3s ease;
|
|
margin-left: 1rem;
|
|
}
|
|
|
|
.docs-link:hover {
|
|
background: var(--accent-color, #5b5fcf);
|
|
color: var(--text-inverse, white);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px var(--accent-shadow, rgba(91, 95, 207, 0.3));
|
|
}
|
|
|
|
.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-gradient, #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 var(--accent-focus, rgba(91, 95, 207, 0.1));
|
|
}
|
|
|
|
.btn-primary {
|
|
background: var(--accent-color, #5b5fcf);
|
|
color: var(--text-inverse, 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-dark, #4547a9);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px var(--accent-shadow-hover, rgba(91, 95, 207, 0.4));
|
|
}
|
|
|
|
.btn-danger {
|
|
background: var(--bg-secondary, #fff);
|
|
color: var(--danger-color, #ef4444);
|
|
border: 1px solid var(--danger-bg-light, #fee2e2);
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 6px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.btn-danger:hover {
|
|
background: var(--danger-color, #ef4444);
|
|
color: var(--text-inverse, white);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.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-light, #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 var(--border-color, #e8e9ff);
|
|
border-top-color: var(--accent-color, #5b5fcf);
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
.forwarding-setup {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
.forwarding-setup h3 {
|
|
color: var(--text-primary, #1e293b);
|
|
font-size: 1.125rem;
|
|
font-weight: 600;
|
|
margin-bottom: 1.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.forwarding-table {
|
|
width: 100%;
|
|
background: var(--bg-secondary, white);
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
margin-top: 2rem;
|
|
}
|
|
|
|
.forwarding-table thead {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
}
|
|
|
|
.forwarding-table th {
|
|
padding: 1rem;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
color: var(--text-primary, #1e293b);
|
|
font-size: 0.875rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
border-bottom: 1px solid var(--border-color, #e8e9ff);
|
|
}
|
|
|
|
.forwarding-table td {
|
|
padding: 1rem;
|
|
color: var(--text-secondary, #64748b);
|
|
font-size: 0.875rem;
|
|
border-bottom: 1px solid var(--border-light, #f3f4f6);
|
|
}
|
|
|
|
.forwarding-table tbody tr:hover {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
}
|
|
|
|
.forwarding-table tbody tr:last-child td {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.option-badge {
|
|
background: var(--accent-bg, #e0e7ff);
|
|
color: var(--accent-color, #5b5fcf);
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 4px;
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
display: inline-block;
|
|
}
|
|
|
|
.warning-icon {
|
|
color: var(--warning-color, #ffa000);
|
|
}
|
|
|
|
.table-id {
|
|
width: 10%;
|
|
}
|
|
|
|
.table-source {
|
|
width: 35%;
|
|
}
|
|
|
|
.table-destination {
|
|
width: 40%;
|
|
}
|
|
|
|
.table-actions {
|
|
width: 15%;
|
|
text-align: center;
|
|
}
|
|
|
|
.email-icon {
|
|
color: var(--accent-color, #5b5fcf);
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.destination-text {
|
|
margin-left: 0.5rem;
|
|
}
|
|
|
|
.full-width-btn {
|
|
width: 100%;
|
|
}
|
|
|
|
@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="emailForwarding">
|
|
<div class="page-header">
|
|
<h1 class="page-title">
|
|
<i class="fas fa-share-square"></i>
|
|
{% trans "Setup Email Forwarding" %}
|
|
<a target="_blank" rel="noopener" href="https://cyberpanel.net/KnowledgeBase/home/email-forwarding/" class="docs-link">
|
|
<i class="fas fa-book"></i>
|
|
{% trans "Forwarding Docs" %}
|
|
</a>
|
|
</h1>
|
|
<p class="page-subtitle">{% trans "Configure email forwarding to redirect messages to other addresses or programs" %}</p>
|
|
</div>
|
|
|
|
<div class="main-card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">
|
|
<i class="fas fa-forward"></i>
|
|
{% trans "Email Forwarding Configuration" %}
|
|
<span ng-show="forwardLoading" 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 warning-icon"></i>
|
|
<h3>{% trans "Postfix is disabled" %}</h3>
|
|
<p class="mb-3">{% trans "You need to enable Postfix to setup email forwarding" %}</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="form-section">
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Select Email Account" %}</label>
|
|
<select ng-change="selectForwardingEmail()" 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 "Forwarding Options" %}</label>
|
|
<select ng-change="selectForwardingEmail()" ng-model="forwardingOption" class="form-control" aria-label="{% trans 'Forwarding Options' %}">
|
|
<option value="Forward to email">{% trans "Forward to email" %}</option>
|
|
<option value="Pipe to program">{% trans "Pipe to program" %}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div ng-hide="creationBox" class="forwarding-setup">
|
|
<h3><i class="fas fa-cog"></i> {% trans "Configure Forwarding" %}</h3>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="form-group mb-3">
|
|
<label class="form-label">{% trans "Source Email" %}</label>
|
|
<input placeholder="{% trans 'Source' %}" type="email" class="form-control" ng-model="selectedEmail" readonly aria-label="{% trans 'Source Email' %}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<div class="form-group mb-3">
|
|
<label class="form-label">{% trans "Destination" %} <span ng-show="forwardingOption == 'Pipe to program'">{% trans "(Path to program)" %}</span></label>
|
|
<input placeholder="{% trans 'Enter destination email or program path' %}" type="text" class="form-control" ng-model="destinationEmail" required aria-label="{% trans 'Destination' %}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<div class="form-group mb-3">
|
|
<label class="form-label"> </label>
|
|
<button type="button" ng-click="forwardEmail()" class="btn-primary full-width-btn">
|
|
<i class="fas fa-plus-circle"></i>
|
|
{% trans "Add Forwarding" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<table class="forwarding-table">
|
|
<thead>
|
|
<tr>
|
|
<th class="table-id">{% trans "ID" %}</th>
|
|
<th class="table-source">{% trans "Source" %}</th>
|
|
<th class="table-destination">{% trans "Destination" %}</th>
|
|
<th class="table-actions">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr ng-repeat="record in records track by $index">
|
|
<td><strong ng-bind="record.id"></strong></td>
|
|
<td>
|
|
<i class="fas fa-envelope email-icon"></i>
|
|
<span ng-bind="record.source"></span>
|
|
</td>
|
|
<td>
|
|
<span class="option-badge" ng-show="record.destination.indexOf('@') > -1">
|
|
<i class="fas fa-at"></i> Email
|
|
</span>
|
|
<span class="option-badge" ng-hide="record.destination.indexOf('@') > -1">
|
|
<i class="fas fa-terminal"></i> Program
|
|
</span>
|
|
<span class="destination-text" ng-bind="record.destination"></span>
|
|
</td>
|
|
<td class="table-actions">
|
|
<button type="button" ng-click="deleteForwarding(record.source, record.destination)" class="btn-danger">
|
|
<i class="fas fa-trash"></i>
|
|
{% trans "Delete" %}
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Alert Messages -->
|
|
<div ng-hide="notifyBox" class="form-section">
|
|
<div ng-hide="forwardError" class="alert alert-danger">
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
{$ errorMessage $}
|
|
</div>
|
|
|
|
<div ng-hide="forwardSuccess" class="alert alert-success">
|
|
<i class="fas fa-check-circle"></i>
|
|
{$ successMessage $}
|
|
</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 %}
|