mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-19 15:09:45 +02:00
487 lines
18 KiB
HTML
487 lines
18 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: #1e293b;
|
|
margin-bottom: 0.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.page-subtitle {
|
|
font-size: 1.125rem;
|
|
color: #64748b;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.docs-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem 1rem;
|
|
background: #fff;
|
|
border: 1px solid #e8e9ff;
|
|
border-radius: 8px;
|
|
color: #5b5fcf;
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
transition: all 0.3s ease;
|
|
margin-left: 1rem;
|
|
}
|
|
|
|
.docs-link:hover {
|
|
background: #5b5fcf;
|
|
color: white;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(91, 95, 207, 0.3);
|
|
}
|
|
|
|
.main-card {
|
|
background: white;
|
|
border-radius: 16px;
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 10px 40px rgba(0,0,0,0.08);
|
|
border: 1px solid #e8e9ff;
|
|
overflow: hidden;
|
|
animation: fadeInUp 0.5s ease-out;
|
|
}
|
|
|
|
.card-header {
|
|
background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
|
|
padding: 1.5rem 2rem;
|
|
border-bottom: 1px solid #e8e9ff;
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: #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: #1e293b;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.form-control {
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border: 1px solid #e8e9ff;
|
|
border-radius: 8px;
|
|
font-size: 0.875rem;
|
|
transition: all 0.3s ease;
|
|
background: #fff;
|
|
}
|
|
|
|
.form-control:focus {
|
|
outline: none;
|
|
border-color: #5b5fcf;
|
|
box-shadow: 0 0 0 3px rgba(91, 95, 207, 0.1);
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #5b5fcf;
|
|
color: 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: #4547a9;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(91, 95, 207, 0.4);
|
|
}
|
|
|
|
.btn-danger {
|
|
background: #fff;
|
|
color: #ef4444;
|
|
border: 1px solid #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: #ef4444;
|
|
color: 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: #d1fae5;
|
|
color: #065f46;
|
|
border: 1px solid #a7f3d0;
|
|
}
|
|
|
|
.alert-danger {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
border: 1px solid #fecaca;
|
|
}
|
|
|
|
.alert-info {
|
|
background: #dbeafe;
|
|
color: #1e40af;
|
|
border: 1px solid #bfdbfe;
|
|
}
|
|
|
|
.disabled-notice {
|
|
background: #fef3c7;
|
|
border: 1px solid #fde68a;
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.disabled-notice h3 {
|
|
color: #92400e;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.loading-spinner {
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid #e8e9ff;
|
|
border-top-color: #5b5fcf;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
.forwarding-setup {
|
|
background: #f8f9ff;
|
|
border: 1px solid #e8e9ff;
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
.forwarding-setup h3 {
|
|
color: #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: white;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
border: 1px solid #e8e9ff;
|
|
margin-top: 2rem;
|
|
}
|
|
|
|
.forwarding-table thead {
|
|
background: #f8f9ff;
|
|
}
|
|
|
|
.forwarding-table th {
|
|
padding: 1rem;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
font-size: 0.875rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
border-bottom: 1px solid #e8e9ff;
|
|
}
|
|
|
|
.forwarding-table td {
|
|
padding: 1rem;
|
|
color: #64748b;
|
|
font-size: 0.875rem;
|
|
border-bottom: 1px solid #f3f4f6;
|
|
}
|
|
|
|
.forwarding-table tbody tr:hover {
|
|
background: #f8f9ff;
|
|
}
|
|
|
|
.forwarding-table tbody tr:last-child td {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.option-badge {
|
|
background: #e0e7ff;
|
|
color: #5b5fcf;
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 4px;
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
display: inline-block;
|
|
}
|
|
|
|
@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" href="http://go.cyberpanel.net/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" style="color: #ffa000;"></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">
|
|
<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">
|
|
<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">
|
|
<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>
|
|
</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>
|
|
</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" style="width: 100%;">
|
|
<i class="fas fa-plus-circle"></i>
|
|
{% trans "Add Forwarding" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<table class="forwarding-table">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 10%;">{% trans "ID" %}</th>
|
|
<th style="width: 35%;">{% trans "Source" %}</th>
|
|
<th style="width: 40%;">{% trans "Destination" %}</th>
|
|
<th style="width: 15%; text-align: center;">{% 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" style="color: #5b5fcf; margin-right: 0.5rem;"></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 style="margin-left: 0.5rem;" ng-bind="record.destination"></span>
|
|
</td>
|
|
<td style="text-align: center;">
|
|
<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 %}
|