firewall rules/settings translation

This commit is contained in:
Eduardo Silva 2025-04-16 12:34:50 -03:00
parent dca75f05a4
commit c60da36047
8 changed files with 194 additions and 80 deletions

View File

@ -153,10 +153,10 @@ class FirewallSettingsForm(forms.ModelForm):
if not interface.startswith('wg') and interface != 'lo':
interface_choices.append((interface, interface))
default_forward_policy = forms.ChoiceField(label='Default Forward Policy', choices=[('accept', 'ACCEPT'), ('reject', 'REJECT'), ('drop', 'DROP')], initial='accept')
allow_peer_to_peer = forms.BooleanField(label='Allow Peer to Peer', required=False)
allow_instance_to_instance = forms.BooleanField(label='Allow Instance to Instance', required=False)
wan_interface = forms.ChoiceField(label='WAN Interface', choices=interface_choices, initial='eth0')
default_forward_policy = forms.ChoiceField(label=_('Default Forward Policy'), choices=[('accept', _('ACCEPT')), ('reject', _('REJECT')), ('drop', _('DROP'))], initial='accept')
allow_peer_to_peer = forms.BooleanField(label=_('Allow Peer to Peer'), required=False)
allow_instance_to_instance = forms.BooleanField(label=_('Allow Instance to Instance'), required=False)
wan_interface = forms.ChoiceField(label=_('WAN Interface'), choices=interface_choices, initial='eth0')
class Meta:
model = FirewallSettings

View File

@ -1,6 +1,7 @@
import uuid
from django.db import models
from django.utils.translation import gettext_lazy as _
from wireguard.models import NETMASK_CHOICES
from wireguard.models import Peer, WireGuardInstance
@ -58,7 +59,7 @@ class FirewallRule(models.Model):
state_untracked = models.BooleanField(default=False)
not_state = models.BooleanField(default=False)
rule_action = models.CharField(max_length=10, default='accept', choices=[('accept', 'ACCEPT'), ('reject', 'REJECT'), ('drop', 'DROP'), ('masquerade', 'MASQUERADE')])
rule_action = models.CharField(max_length=10, default='accept', choices=[('accept', _('ACCEPT')), ('reject', _('REJECT')), ('drop', _('DROP')), ('masquerade', _('MASQUERADE'))])
sort_order = models.PositiveIntegerField(default=0)
created = models.DateTimeField(auto_now_add=True)
@ -71,8 +72,8 @@ class FirewallRule(models.Model):
class FirewallSettings(models.Model):
name = models.CharField(max_length=6, default='global', unique=True)
default_forward_policy = models.CharField(max_length=6, default='accept', choices=[('accept', 'ACCEPT'), ('reject', 'REJECT'), ('drop', 'DROP')])
default_output_policy = models.CharField(max_length=6, default='accept', choices=[('accept', 'ACCEPT'), ('reject', 'REJECT'), ('drop', 'DROP')])
default_forward_policy = models.CharField(max_length=6, default='accept', choices=[('accept', _('ACCEPT')), ('reject', _('REJECT')), ('drop', _('DROP'))])
default_output_policy = models.CharField(max_length=6, default='accept', choices=[('accept', _('ACCEPT')), ('reject', _('REJECT')), ('drop', _('DROP'))])
allow_peer_to_peer = models.BooleanField(default=True)
allow_instance_to_instance = models.BooleanField(default=True)
wan_interface = models.CharField(max_length=12, default='eth0')

View File

@ -1,4 +1,5 @@
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from firewall.models import FirewallRule, FirewallSettings, RedirectRule
from wireguard.models import PeerAllowedIP, WireGuardInstance
@ -40,7 +41,7 @@ def reset_firewall_to_default():
FirewallRule.objects.create(
firewall_chain='postrouting', sort_order=0, out_interface=firewall_settings.wan_interface, rule_action='masquerade',
description='Masquerade traffic from VPN to WAN',
description=_('Masquerade traffic from VPN to WAN'),
)
# This rule will now be fixed in the firewall header
@ -50,19 +51,19 @@ def reset_firewall_to_default():
# )
FirewallRule.objects.create(
firewall_chain='forward', sort_order=1, rule_action='reject', description='Reject traffic to private networks exiting on WAN interface',
firewall_chain='forward', sort_order=1, rule_action='reject', description=_('Reject traffic to private networks exiting on WAN interface'),
in_interface='wg+', out_interface=firewall_settings.wan_interface, destination_ip='10.0.0.0', destination_netmask=8
)
FirewallRule.objects.create(
firewall_chain='forward', sort_order=2, rule_action='reject', description='Reject traffic to private networks exiting on WAN interface',
firewall_chain='forward', sort_order=2, rule_action='reject', description=_('Reject traffic to private networks exiting on WAN interface'),
in_interface='wg+', out_interface=firewall_settings.wan_interface, destination_ip='172.16.0.0', destination_netmask=12
)
FirewallRule.objects.create(
firewall_chain='forward', sort_order=3, rule_action='reject', description='Reject traffic to private networks exiting on WAN interface',
firewall_chain='forward', sort_order=3, rule_action='reject', description=_('Reject traffic to private networks exiting on WAN interface'),
in_interface='wg+', out_interface=firewall_settings.wan_interface, destination_ip='192.168.0.0', destination_netmask=16
)
FirewallRule.objects.create(
firewall_chain='forward', sort_order=10, rule_action='accept', description='Allow traffic from VPN to WAN',
firewall_chain='forward', sort_order=10, rule_action='accept', description=_('Allow traffic from VPN to WAN'),
in_interface='wg+', out_interface=firewall_settings.wan_interface
)
return

View File

@ -76,7 +76,7 @@ def view_firewall_rule_list(request):
if current_chain not in ['forward', 'portforward', 'postrouting']:
current_chain = 'forward'
context = {
'page_title': 'Firewall Rule List',
'page_title': _('Firewall Rule List'),
'firewall_rule_list': FirewallRule.objects.filter(firewall_chain=current_chain).order_by('sort_order'),
'current_chain': current_chain,
'port_forward_list': RedirectRule.objects.all().order_by('port'),
@ -90,7 +90,7 @@ def view_firewall_rule_list(request):
def manage_firewall_rule(request):
if not UserAcl.objects.filter(user=request.user).filter(user_level__gte=40).exists():
return render(request, 'access_denied.html', {'page_title': 'Access Denied'})
context = {'page_title': 'Manage Firewall Rule'}
context = {'page_title': _('Manage Firewall Rule')}
instance = None
uuid = request.GET.get('uuid', None)
if uuid:
@ -108,9 +108,9 @@ def manage_firewall_rule(request):
if wireguard_instance:
wireguard_instance.pending_changes = True
wireguard_instance.save()
messages.success(request, 'Firewall rule deleted successfully')
messages.success(request, _('Firewall rule deleted successfully'))
else:
messages.warning(request, 'Error deleting Firewall rule|Confirmation did not match. Firewall rule was not deleted.')
messages.warning(request, _('Error deleting Firewall rule|Confirmation did not match. Firewall rule was not deleted.'))
return redirect('/firewall/rule_list/')
else:
current_chain = request.GET.get('chain', 'forward')
@ -122,7 +122,7 @@ def manage_firewall_rule(request):
firewall_settings.pending_changes = True
firewall_settings.save()
form.save()
messages.success(request, 'Firewall rule saved successfully')
messages.success(request, _('Firewall rule saved successfully'))
# Marking wireguard_instance as having pending changes, not the best way to do this, but it works for now.
# I will improve it later.
wireguard_instance = WireGuardInstance.objects.all().first()
@ -154,7 +154,7 @@ def manage_firewall_rule(request):
def view_manage_firewall_settings(request):
if not UserAcl.objects.filter(user=request.user).filter(user_level__gte=40).exists():
return render(request, 'access_denied.html', {'page_title': 'Access Denied'})
context = {'page_title': 'Manage Firewall Settings'}
context = {'page_title': _('Manage Firewall Settings')}
previous_firewall_chain = request.GET.get('chain')
if previous_firewall_chain not in ['forward', 'portforward', 'postrouting']:
previous_firewall_chain = 'forward'
@ -170,7 +170,7 @@ def view_manage_firewall_settings(request):
form = FirewallSettingsForm(request.POST, instance=firewall_settings)
if form.is_valid():
form.save()
messages.success(request, 'Firewall settings saved successfully')
messages.success(request, _('Firewall settings saved successfully'))
# Marking wireguard_instance as having pending changes, not the best way to do this, but it works for now.
# I will improve it later.
wireguard_instance = WireGuardInstance.objects.all().first()

Binary file not shown.

View File

@ -6,9 +6,10 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-16 11:43-0300\n"
"POT-Creation-Date: 2025-04-16 12:32-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -251,6 +252,25 @@ msgstr ""
msgid "Default Forward Policy"
msgstr "Política Padrão (Forward)"
#: firewall/forms.py:156 firewall/models.py:62 firewall/models.py:75
#: firewall/models.py:76 templates/firewall/firewall_rule_list.html:63
#: templates/firewall/firewall_rule_list.html:91
#: templates/firewall/firewall_rule_list.html:168
#: templates/firewall/firewall_rule_list.html:187
msgid "ACCEPT"
msgstr "ACEITA"
#: firewall/forms.py:156 firewall/models.py:62 firewall/models.py:75
#: firewall/models.py:76 templates/firewall/firewall_rule_list.html:170
#: templates/firewall/firewall_rule_list.html:187
msgid "REJECT"
msgstr "REJEITA"
#: firewall/forms.py:156 firewall/models.py:62 firewall/models.py:75
#: firewall/models.py:76
msgid "DROP"
msgstr "DESCARTA"
#: firewall/forms.py:157
msgid "Allow Peer to Peer"
msgstr "Permitir tráfego entre Peers"
@ -263,6 +283,22 @@ msgstr "Permitir tráfego entre Instâncias"
msgid "WAN Interface"
msgstr "Interface WAN"
#: firewall/models.py:62
msgid "MASQUERADE"
msgstr "MASCARAR"
#: firewall/tools.py:44
msgid "Masquerade traffic from VPN to WAN"
msgstr "Mascarar tráfego da VPN para a WAN"
#: firewall/tools.py:54 firewall/tools.py:58 firewall/tools.py:62
msgid "Reject traffic to private networks exiting on WAN interface"
msgstr "Rejeitar tráfego para redes privadas saindo pela interface WAN"
#: firewall/tools.py:66
msgid "Allow traffic from VPN to WAN"
msgstr "Permitir tráfego da VPN para a WAN"
#: firewall/views.py:21
msgid "Port Forward List"
msgstr "Lista de Encaminhamento de Porta"
@ -466,6 +502,101 @@ msgstr "Encaminhamento de Porta"
msgid "Default Policy"
msgstr "Política Padrão"
#: templates/firewall/firewall_rule_list.html:40
msgid "In"
msgstr "Entrada"
#: templates/firewall/firewall_rule_list.html:41
msgid "Out"
msgstr "Saída"
#: templates/firewall/firewall_rule_list.html:42
msgid "Source"
msgstr "Origem"
#: templates/firewall/firewall_rule_list.html:43
#: templates/firewall/redirect_rule_list.html:15
msgid "Destination"
msgstr "Destino"
#: templates/firewall/firewall_rule_list.html:44
#: templates/firewall/manage_redirect_rule.html:22
#: templates/firewall/redirect_rule_list.html:13
msgid "Protocol"
msgstr "Protocolo"
#: templates/firewall/firewall_rule_list.html:45
#: templates/firewall/manage_redirect_rule.html:30
#: templates/firewall/redirect_rule_list.html:14
#: templates/wireguard/wireguard_status.html:47 vpn_invite/forms.py:284
msgid "Port"
msgstr "Porta"
#: templates/firewall/firewall_rule_list.html:46
msgid "State"
msgstr "Estado"
#: templates/firewall/firewall_rule_list.html:47
msgid "Action"
msgstr "Ação"
#: templates/firewall/firewall_rule_list.html:53
msgid "Automatic rule: Allow established/related traffic"
msgstr "Regra Automática: Permitir tráfego estabelecido/relacionado"
#: templates/firewall/firewall_rule_list.html:58
#: templates/firewall/firewall_rule_list.html:138
msgid "all"
msgstr "Todos"
#: templates/firewall/firewall_rule_list.html:60
#: templates/firewall/firewall_rule_list.html:142
msgid "Related"
msgstr "Relacionado"
#: templates/firewall/firewall_rule_list.html:61
#: templates/firewall/firewall_rule_list.html:143
msgid "Established"
msgstr "Estabelecido"
#: templates/firewall/firewall_rule_list.html:71
#: templates/firewall/firewall_rule_list.html:97
msgid "Automatic Rule: Port forward."
msgstr "Regra Automática: Encaminhamento de Porta."
#: templates/firewall/firewall_rule_list.html:141
msgid "New"
msgstr "Novo"
#: templates/firewall/firewall_rule_list.html:144
msgid "Invalid"
msgstr "Inválido"
#: templates/firewall/firewall_rule_list.html:145
msgid "Untracked"
msgstr "Não rastreado"
#: templates/firewall/firewall_rule_list.html:158
msgid "Automatic Rule: Firewall Settings Peer to Peer traffic"
msgstr "Regra Automática: Configurações de Firewall tráfego entre Peers"
#: templates/firewall/firewall_rule_list.html:179
msgid "Automatic Rule: Firewall Settings Instance to Instance"
msgstr "Regra Automática: permitir tráfego entre Instâncias"
#: templates/firewall/firewall_rule_list.html:194
msgid "Create Firewall Rule"
msgstr "Criar Regra de Firewall"
#: templates/firewall/firewall_rule_list.html:195
#: templates/firewall/redirect_rule_list.html:59
msgid "Firewall Settings"
msgstr "Configuração de Firewall"
#: templates/firewall/firewall_rule_list.html:196
msgid "Display automatic rules"
msgstr "Mostrar regras automáticas"
#: templates/firewall/manage_firewall_settings.html:61
msgid "Reset firewall to default"
msgstr "Redefinir firewall para o padrão"
@ -480,17 +611,6 @@ msgstr ""
"Você tem certeza que deseja continuar?\\n\\nDigite 'delete all rules and "
"reset firewall' para confirmar."
#: templates/firewall/manage_redirect_rule.html:22
#: templates/firewall/redirect_rule_list.html:13
msgid "Protocol"
msgstr "Protocolo"
#: templates/firewall/manage_redirect_rule.html:30
#: templates/firewall/redirect_rule_list.html:14
#: templates/wireguard/wireguard_status.html:47 vpn_invite/forms.py:284
msgid "Port"
msgstr "Porta"
#: templates/firewall/manage_redirect_rule.html:35
msgid "Destination Port"
msgstr "Porta de Destino"
@ -580,10 +700,6 @@ msgstr "Para excluir esta regra, digite:"
msgid "Instance"
msgstr "Instância"
#: templates/firewall/redirect_rule_list.html:15
msgid "Destination"
msgstr "Destino"
#: templates/firewall/redirect_rule_list.html:16
msgid "Allow Forward"
msgstr "Permitir Encaminhamento"
@ -604,10 +720,6 @@ msgstr ""
msgid "Create Port forwarding Rule"
msgstr "Criar Regra de Encaminhamento de Porta"
#: templates/firewall/redirect_rule_list.html:59
msgid "Firewall Settings"
msgstr "Configuração de Firewall"
#: templates/user_manager/list.html:9 user_manager/forms.py:20
msgid "User Level"
msgstr "Nível de Acesso"

View File

@ -1,15 +1,16 @@
{% extends 'base.html' %}
{% load i18n %}
{% block page_custom_head %}
<style>
.first-line-container {
display: flex;
align-items: center; /* Centraliza os itens verticalmente */
align-items: center;
width: 100%;
}
.more-link {
margin-left: auto; /* Empurra o link para a direita */
margin-left: auto;
text-decoration: none;
}
@ -36,30 +37,30 @@
<thead>
<th>#</th>
<th><i class="fas fa-info-circle"></i></th>
<th>In</th>
<th>Out</th>
<th>Source</th>
<th>Destination</th>
<th>Protocol</th>
<th>Port</th>
<th>State</th>
<th>Action</th>
<th>{% trans 'In' %}</th>
<th>{% trans 'Out' %}</th>
<th>{% trans 'Source' %}</th>
<th>{% trans 'Destination' %}</th>
<th>{% trans 'Protocol' %}</th>
<th>{% trans 'Port' %}</th>
<th>{% trans 'State' %}</th>
<th>{% trans 'Action' %}</th>
<th><i class="far fa-edit"></i></th>
</thead>
<tbody>
<tr class="fw_automatic_rule">
<td>-</td>
<td><i class="fas fa-info-circle" title="Automatic rule: Allow established/related traffic"></i></td>
<td><i class="fas fa-info-circle" title="{% trans 'Automatic rule: Allow established/related traffic' %}"></i></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>all</td>
<td>{% trans 'all' %}</td>
<td></td>
<td>Related<br>
Established
<td>{% trans 'Related' %}<br>
{% trans 'Established' %}
</td>
<td>ACCEPT</td>
<td>{% trans 'ACCEPT' %}</td>
<td></td>
</tr>
@ -67,7 +68,7 @@
{% if rule.add_forward_rule and current_chain == 'forward' %}
<tr class="fw_automatic_rule">
<td>-</td>
<td><i class="fas fa-info-circle" title="Port forward automatic rule. {{ rule.description|default_if_none:'' }}"></i></td>
<td><i class="fas fa-info-circle" title="{% trans 'Automatic Rule: Port forward.' %} {{ rule.description|default_if_none:'' }}"></i></td>
<td>{{ firewall_settings.wan_interface }}</td>
<td>wg{{ rule.wireguard_instance.instance_id }}</td>
<td></td>
@ -87,13 +88,13 @@
{% endif %}
</td>
<td></td>
<td>ACCEPT</td>
<td>{% trans 'ACCEPT' %}</td>
<td></td>
</tr>
{% elif rule.masquerade_source and current_chain == 'postrouting' %}
<tr class="fw_automatic_rule">
<td>-</td>
<td><i class="fas fa-info-circle" title="Port forward automatic rule. {{ rule.description|default_if_none:'' }}"></i></td>
<td><i class="fas fa-info-circle" title="{% trans 'Automatic Rule: Port forward.' %} {{ rule.description|default_if_none:'' }}"></i></td>
<td></td>
<td>wg{{ rule.wireguard_instance.instance_id }}</td>
<td></td>
@ -134,14 +135,14 @@
{% if rule.destination_ip %}{% if rule.not_destination %}<span title="Not destination">!</span> {% endif %}{{ rule.destination_ip }}/{{ rule.destination_netmask }}<br>{% endif%}
{% for peer in rule.destination_peer.all %}{% if rule.not_destination %}<span title="Not destination">!</span> {% endif %}{{ peer }}{% if rule.destination_peer_include_networks %} <span title="Include peer networks">+</span>{% endif %}<br>{% endfor %}
</td>
<td>{{ rule.get_protocol_display|default_if_none:'all' }}</td>
<td>{% if rule.protocol %}{{ rule.get_protocol_display }}{% else %}{% trans 'all' %}{% endif %}</td>
<td>{{ rule.destination_port|default_if_none:'' }}</td>
<td>
{% if rule.state_new %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}New<br>{% endif %}
{% if rule.state_related %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}Related<br>{% endif %}
{% if rule.state_established %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}Established<br>{% endif %}
{% if rule.state_invalid %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}Invalid<br>{% endif %}
{% if rule.state_untracked %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}Untracked<br>{% endif %}
{% if rule.state_new %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}{% trans 'New' %}<br>{% endif %}
{% if rule.state_related %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}{% trans 'Related' %}<br>{% endif %}
{% if rule.state_established %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}{% trans 'Established' %}<br>{% endif %}
{% if rule.state_invalid %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}{% trans 'Invalid' %}<br>{% endif %}
{% if rule.state_untracked %}{% if rule.not_state %}<span title="Not state">! </span>{% endif %}{% trans 'Untracked' %}<br>{% endif %}
</td>
<td>{{ rule.get_rule_action_display }}</td>
<td style="width: 1%; white-space: nowrap;">
@ -154,7 +155,7 @@
{% for wireguard_instance in wireguard_instances %}
<tr class="fw_automatic_rule">
<td>-</td>
<td><i class="fas fa-info-circle" title="Automatic Rule: Firewall Settings Peer to Peer traffic"></i></td>
<td><i class="fas fa-info-circle" title="{% trans 'Automatic Rule: Firewall Settings Peer to Peer traffic' %}"></i></td>
<td>wg{{ wireguard_instance.instance_id }}</td>
<td>wg{{ wireguard_instance.instance_id }}</td>
<td></td>
@ -164,9 +165,9 @@
<td></td>
<td>
{% if firewall_settings.allow_peer_to_peer %}
ACCEPT
{% trans 'ACCEPT' %}
{% else %}
REJECT
{% trans 'REJECT' %}
{% endif %}
</td>
<td></td>
@ -175,7 +176,7 @@
<tr class="fw_automatic_rule">
<td>-</td>
<td><i class="fas fa-info-circle" title="Automatic Rule: Firewall Settings Instance to Instance"></i></td>
<td><i class="fas fa-info-circle" title="{% trans 'Automatic Rule: Firewall Settings Instance to Instance' %}"></i></td>
<td>wg+</td>
<td>wg+</td>
<td></td>
@ -183,16 +184,16 @@
<td></td>
<td></td>
<td></td>
<td>{% if firewall_settings.allow_instance_to_instance %}ACCEPT{% else %}REJECT{% endif %}</td>
<td>{% if firewall_settings.allow_instance_to_instance %}{% trans 'ACCEPT' %}{% else %}{% trans 'REJECT' %}{% endif %}</td>
<td></td>
</tr>
{% endif %}
</tbody>
</table>
<a href="/firewall/manage_firewall_rule/?chain={{ current_chain }}" class='btn btn-primary'>Create Firewall Rule</a>
<a href="/firewall/firewall_settings/?chain={{ current_chain }}" class='btn btn-outline-primary'>Firewall Settings</a>
<a class='btn btn-outline-primary' onclick=$('.fw_automatic_rule').slideToggle();>Display automatic rules</a>
<a href="/firewall/manage_firewall_rule/?chain={{ current_chain }}" class='btn btn-primary'>{% trans 'Create Firewall Rule' %}</a>
<a href="/firewall/firewall_settings/?chain={{ current_chain }}" class='btn btn-outline-primary'>{% trans 'Firewall Settings' %}</a>
<a class='btn btn-outline-primary' onclick=$('.fw_automatic_rule').slideToggle();>{% trans 'Display automatic rules' %}</a>
</div>
</div>
</div>
@ -208,7 +209,6 @@
if (brCount >= 2) {
let contentParts = td.innerHTML.split('<br>');
// Mantém a estrutura do contêiner com o texto e o link "More"
let firstLineContainer = `<div class="first-line-container">${contentParts[0]}<a href="#" class="more-link">more</a></div>`;
td.innerHTML = firstLineContainer +
@ -219,8 +219,8 @@
document.querySelectorAll('.more-link').forEach(function(link) {
link.addEventListener('click', function(e) {
e.preventDefault(); // Impede a ação padrão do link
let moreText = this.parentNode.nextElementSibling; // Seleciona o span corretamente
e.preventDefault();
let moreText = this.parentNode.nextElementSibling;
if (moreText.style.display === "none") {
moreText.style.display = "inline";
this.textContent = "less";

View File

@ -1,9 +1,9 @@
{% extends 'base.html' %}
{% load i18n %}
{% block content %}
<div class="row">
<div class="col-md-4">
<div class="col-md-6">
<form method="post">
{% csrf_token %}
<div class="card">
@ -56,9 +56,9 @@
</div>
<div class="card-footer">
<button type="submit" class="btn btn-primary">Submit</button>
<a class="btn btn-outline-secondary" href="{{ back_url }}">Back</a>
<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>Reset firewall to default</a>
<button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
<a class="btn btn-outline-secondary" href="{{ back_url }}">{% trans 'Back' %}</a>
<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>{% trans 'Reset firewall to default' %}</a>
</div>
</div>
</form>
@ -74,7 +74,7 @@
<script>
function openCommandDialog(element) {
var command = element.getAttribute('data-command');
var confirmation = prompt("Reseting the firewall to default will remove all rules and settings. Are you sure you want to continue?\n\nType 'delete all rules and reset firewall' to confirm. ");
var confirmation = prompt("{% trans "Reseting the firewall to default will remove all rules and settings. Are you sure you want to continue?\n\nType 'delete all rules and reset firewall' to confirm." %}");
if (confirmation) {
var url = "/firewall/reset_to_default/?confirmation=" + encodeURIComponent(confirmation);
window.location.href = url;