mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
networks: Minor changes to router/internet configuration forms
- Cosmetic styling fixes. Having doc string as suggested by Python doc string guidelines. - 'connected to the Internet' seems much more popular phrase than 'connected on the Internet' judging by web search results. - Stylize as 'Internet' for consistency although 'internet' is correct too. - Add space at the end of main radio button option text as translators seems to understand it incorrectly. See current Spanish translation. - Recommend 'DMZ' for router configuration. - Remove incorrect title casing port forwarding text. - Internationalize some strings. - Update the default value for router configuration to 'not_configured'. - Update the default value for Internet connection type to None so that nothing is selected by default. We could consider introducing a fourth option 'not_configured'. - Update the ID of first boot wizard step for Internet connectivity. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
1ba55e793f
commit
3e8ce0c6bd
@ -20,7 +20,7 @@ managed_packages = ['network-manager', 'batctl']
|
|||||||
|
|
||||||
first_boot_steps = [
|
first_boot_steps = [
|
||||||
{
|
{
|
||||||
'id': 'internet_connectivity_type',
|
'id': 'internet_connectivity_type_wizard',
|
||||||
'url': 'networks:firstboot_internet_connection_type',
|
'url': 'networks:firstboot_internet_connection_type',
|
||||||
'order': 3,
|
'order': 3,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -286,10 +286,12 @@ requires clients to have the password to connect.'),
|
|||||||
|
|
||||||
|
|
||||||
class InternetConnectionTypeForm(forms.Form):
|
class InternetConnectionTypeForm(forms.Form):
|
||||||
"""
|
"""Form for type of public/private IP address ISP provides.
|
||||||
|
|
||||||
Ask the user for what type of Internet connection they have. We store this
|
Ask the user for what type of Internet connection they have. We store this
|
||||||
information and use it suggest various setup options during the setup
|
information and use it suggest various setup options during the setup
|
||||||
process and also later on when setting up apps.
|
process and also later on when setting up apps.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
internet_connection_type = forms.ChoiceField(
|
internet_connection_type = forms.ChoiceField(
|
||||||
label=_('Choose your internet connection type'),
|
label=_('Choose your internet connection type'),
|
||||||
@ -298,7 +300,7 @@ class InternetConnectionTypeForm(forms.Form):
|
|||||||
format_lazy(
|
format_lazy(
|
||||||
_('I have a public IP address that may change over time'
|
_('I have a public IP address that may change over time'
|
||||||
'<p class="help-block">This means that devices on the '
|
'<p class="help-block">This means that devices on the '
|
||||||
'internet can reach you when you are connected on the '
|
'Internet can reach you when you are connected to the '
|
||||||
'Internet. Every time you connect to the Internet with '
|
'Internet. Every time you connect to the Internet with '
|
||||||
'your Internet Service Provider (ISP), you may get a '
|
'your Internet Service Provider (ISP), you may get a '
|
||||||
'different IP address, especially after some offline time. '
|
'different IP address, especially after some offline time. '
|
||||||
@ -311,7 +313,7 @@ class InternetConnectionTypeForm(forms.Form):
|
|||||||
_('I have a public IP address that does not change overtime '
|
_('I have a public IP address that does not change overtime '
|
||||||
'(recommended)'
|
'(recommended)'
|
||||||
'<p class="help-block">This means that devices on the '
|
'<p class="help-block">This means that devices on the '
|
||||||
'Internet can reach you when you are connected on the '
|
'Internet can reach you when you are connected to the '
|
||||||
'Internet. Every time you connect to the Internet with '
|
'Internet. Every time you connect to the Internet with '
|
||||||
'your Internet Service Provider (ISP), you always get the '
|
'your Internet Service Provider (ISP), you always get the '
|
||||||
'same IP address. This is the most trouble-free setup for '
|
'same IP address. This is the most trouble-free setup for '
|
||||||
@ -339,10 +341,11 @@ class InternetConnectionTypeForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class RouterConfigurationWizardForm(forms.Form):
|
class RouterConfigurationWizardForm(forms.Form):
|
||||||
"""
|
"""Form to suggest how to configure a router.
|
||||||
Form to suggest router configuration depending on wan
|
|
||||||
connectivity/specific setup. The choice will affect
|
Suggest depending on wan connectivity/specific setup. The choice will
|
||||||
future suggestions during the setup process and other apps.
|
affect future suggestions during the setup process and other apps.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
router_config = forms.ChoiceField(
|
router_config = forms.ChoiceField(
|
||||||
label=_('Preferred router configuration'),
|
label=_('Preferred router configuration'),
|
||||||
@ -350,20 +353,20 @@ class RouterConfigurationWizardForm(forms.Form):
|
|||||||
(
|
(
|
||||||
'dmz',
|
'dmz',
|
||||||
format_lazy(
|
format_lazy(
|
||||||
_('Use DMZ feature to forward all traffic'
|
_('Use DMZ feature to forward all traffic (recommended) '
|
||||||
'<p class="help-block">Most routers provide a '
|
'<p class="help-block">Most routers provide a '
|
||||||
'configuration setting called DMZ. This will allow the '
|
'configuration setting called DMZ. This will allow the '
|
||||||
'router to forward all incoming traffic from the '
|
'router to forward all incoming traffic from the '
|
||||||
'internet to a single IP address such as the '
|
'Internet to a single IP address such as the '
|
||||||
'{box_name}\'s address. First remember to configure a '
|
'{box_name}\'s IP address. First remember to configure '
|
||||||
'static local IP address for your {box_name} in your '
|
'a static local IP address for your {box_name} in your '
|
||||||
'router\'s configuration.</p>'), box_name=cfg.box_name,
|
'router\'s configuration.</p>'), box_name=cfg.box_name,
|
||||||
allow_markup=True),
|
allow_markup=True),
|
||||||
),
|
),
|
||||||
('port_forwarding',
|
('port_forwarding',
|
||||||
format_lazy(
|
format_lazy(
|
||||||
_('Forward Specific Traffic as needed by each '
|
_('Forward specific traffic as needed by each '
|
||||||
'application'
|
'application '
|
||||||
'<p class="help-block">You may alternatively choose to '
|
'<p class="help-block">You may alternatively choose to '
|
||||||
'forward only specific traffic to your {box_name}. '
|
'forward only specific traffic to your {box_name}. '
|
||||||
'This is ideal if you have other servers like '
|
'This is ideal if you have other servers like '
|
||||||
@ -376,7 +379,7 @@ class RouterConfigurationWizardForm(forms.Form):
|
|||||||
allow_markup=True)),
|
allow_markup=True)),
|
||||||
('not_configured',
|
('not_configured',
|
||||||
format_lazy(
|
format_lazy(
|
||||||
_('Router is currently unconfigured'
|
_('Router is currently unconfigured '
|
||||||
'<p class="help-block">Choose this if you have not '
|
'<p class="help-block">Choose this if you have not '
|
||||||
'configured or are unable to configure the router '
|
'configured or are unable to configure the router '
|
||||||
'currently and wish to be reminded later. Some of '
|
'currently and wish to be reminded later. Some of '
|
||||||
|
|||||||
@ -11,15 +11,10 @@ from django.views.decorators.http import require_POST
|
|||||||
|
|
||||||
from plinth import kvstore, network
|
from plinth import kvstore, network
|
||||||
from plinth.modules import first_boot, networks
|
from plinth.modules import first_boot, networks
|
||||||
from .forms import (
|
|
||||||
ConnectionTypeSelectForm,
|
from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
|
||||||
EthernetForm,
|
InternetConnectionTypeForm, PPPoEForm,
|
||||||
GenericForm,
|
RouterConfigurationWizardForm, WifiForm)
|
||||||
PPPoEForm,
|
|
||||||
WifiForm,
|
|
||||||
RouterConfigurationWizardForm,
|
|
||||||
InternetConnectionTypeForm,
|
|
||||||
)
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -28,6 +23,8 @@ def index(request):
|
|||||||
"""Show connection list."""
|
"""Show connection list."""
|
||||||
connections = network.get_connection_list()
|
connections = network.get_connection_list()
|
||||||
|
|
||||||
|
internet_connection_type = kvstore.get_default(
|
||||||
|
networks.INTERNET_CONNECTION_TYPE_KEY, None)
|
||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
request, 'networks_configuration.html', {
|
request, 'networks_configuration.html', {
|
||||||
'app_id': 'networks',
|
'app_id': 'networks',
|
||||||
@ -36,8 +33,7 @@ def index(request):
|
|||||||
'has_diagnostics': True,
|
'has_diagnostics': True,
|
||||||
'is_enabled': True,
|
'is_enabled': True,
|
||||||
'connections': connections,
|
'connections': connections,
|
||||||
'internet_connectivity_type': kvstore.get_default(
|
'internet_connectivity_type': internet_connection_type
|
||||||
networks.INTERNET_CONNECTION_TYPE_KEY, "dynamic_public_ip")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -410,9 +406,10 @@ def delete(request, uuid):
|
|||||||
|
|
||||||
|
|
||||||
def router_configuration_help_page(request):
|
def router_configuration_help_page(request):
|
||||||
"""
|
"""Show the router configuration wizard page/form.
|
||||||
Show the router configuration wizard page/form.
|
|
||||||
Used both for fistboot step and same networks page.
|
Used both for fistboot step and same networks page.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
is_firstboot = True \
|
is_firstboot = True \
|
||||||
if 'firstboot' in request.build_absolute_uri() else False
|
if 'firstboot' in request.build_absolute_uri() else False
|
||||||
@ -431,19 +428,18 @@ def router_configuration_help_page(request):
|
|||||||
messages.success(request, _('Router configuration type saved.'))
|
messages.success(request, _('Router configuration type saved.'))
|
||||||
|
|
||||||
return redirect(resp)
|
return redirect(resp)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
html = "router_configuration_update.html"
|
html = 'router_configuration_update.html'
|
||||||
initial = {
|
initial = {
|
||||||
"router_config":
|
'router_config':
|
||||||
kvstore.get_default(networks.ROUTER_CONFIGURATION_TYPE_KEY,
|
kvstore.get_default(networks.ROUTER_CONFIGURATION_TYPE_KEY,
|
||||||
'dmz'),
|
'not_configured'),
|
||||||
}
|
}
|
||||||
template_kwargs = {
|
template_kwargs = {
|
||||||
'form': RouterConfigurationWizardForm(initial=initial),
|
'form': RouterConfigurationWizardForm(initial=initial),
|
||||||
}
|
}
|
||||||
if is_firstboot:
|
if is_firstboot:
|
||||||
html = "router_configuration_firstboot.html"
|
html = 'router_configuration_firstboot.html'
|
||||||
|
|
||||||
# mark step done on firstboot visit to get the next_step
|
# mark step done on firstboot visit to get the next_step
|
||||||
first_boot.mark_step_done('router_setup_wizard')
|
first_boot.mark_step_done('router_setup_wizard')
|
||||||
@ -455,9 +451,10 @@ def router_configuration_help_page(request):
|
|||||||
|
|
||||||
|
|
||||||
def internet_connection_type_help_page(request):
|
def internet_connection_type_help_page(request):
|
||||||
"""
|
"""Show the internet connection type page.
|
||||||
Show the internet connection type page.
|
|
||||||
Used for first boot step and networks page.
|
Used for first boot step and networks page.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
is_firstboot = True \
|
is_firstboot = True \
|
||||||
if 'firstboot' in request.build_absolute_uri() else False
|
if 'firstboot' in request.build_absolute_uri() else False
|
||||||
@ -477,17 +474,18 @@ def internet_connection_type_help_page(request):
|
|||||||
messages.success(request, _('Internet connection type saved.'))
|
messages.success(request, _('Internet connection type saved.'))
|
||||||
return redirect(reverse_lazy('networks:index'))
|
return redirect(reverse_lazy('networks:index'))
|
||||||
else:
|
else:
|
||||||
html = "internet_connectivity_type.html"
|
html = 'internet_connectivity_type.html'
|
||||||
initial = {
|
initial = {
|
||||||
"internet_connection_type": kvstore.get_default(
|
'internet_connection_type':
|
||||||
networks.INTERNET_CONNECTION_TYPE_KEY, 'dynamic_public_ip'),
|
kvstore.get_default(networks.INTERNET_CONNECTION_TYPE_KEY,
|
||||||
|
None)
|
||||||
}
|
}
|
||||||
template_kwargs = {'form': InternetConnectionTypeForm(initial=initial)}
|
template_kwargs = {'form': InternetConnectionTypeForm(initial=initial)}
|
||||||
if is_firstboot:
|
if is_firstboot:
|
||||||
html = "internet_connectivity_firstboot.html"
|
html = 'internet_connectivity_firstboot.html'
|
||||||
|
|
||||||
# mark step done on firstboot visit to get the next_step
|
# mark step done on firstboot visit to get the next_step
|
||||||
first_boot.mark_step_done('internet_connectivity_type')
|
first_boot.mark_step_done('internet_connectivity_type_wizard')
|
||||||
template_kwargs.update({
|
template_kwargs.update({
|
||||||
'first_boot_next_step': reverse_lazy(first_boot.next_step()),
|
'first_boot_next_step': reverse_lazy(first_boot.next_step()),
|
||||||
})
|
})
|
||||||
|
|||||||
@ -15,9 +15,7 @@
|
|||||||
|
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
|
||||||
<a href='{{ first_boot_next_step }}'>{% trans "skip this step" %}</a>
|
<a href='{{ first_boot_next_step }}'>{% trans "Skip this step" %}</a>
|
||||||
<input type="submit" class="btn btn-primary"
|
<input type="submit" class="btn btn-primary pull-right" value="{% trans "Next" %}"/>
|
||||||
value="{% trans "Next" %}" style="float: right;"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -20,15 +20,20 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% if internet_connectivity_type == "static_public_ip" %}
|
{% if internet_connectivity_type == "static_public_ip" %}
|
||||||
My ISP provides a public IP address that does not change over time.
|
{% blocktrans trimmed %}
|
||||||
|
My ISP provides a public IP address that does not change over time.
|
||||||
|
{% endblocktrans %}
|
||||||
{% elif internet_connectivity_type == "dynamic_public_ip" %}
|
{% elif internet_connectivity_type == "dynamic_public_ip" %}
|
||||||
My ISP provides a public IP address that may change over time.
|
{% blocktrans trimmed %}
|
||||||
|
My ISP provides a public IP address that may change over time.
|
||||||
|
{% endblocktrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
I don't have a public IP address.
|
{% blocktrans trimmed %}
|
||||||
|
My ISP does not provide a public IP address.
|
||||||
|
{% endblocktrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'networks:internet_connection_type_setup' %}" class="btn btn-default"
|
<a href="{% url 'networks:internet_connection_type_setup' %}" class="btn btn-default"
|
||||||
role="button" title="{% trans 'Update...' %}">
|
role="button">
|
||||||
<span class="fa" aria-hidden="true"></span>
|
|
||||||
{% trans 'Update...' %}
|
{% trans 'Update...' %}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary"
|
<input type="submit" class="btn btn-primary" value="{% trans "Submit" %}"/>
|
||||||
value="{% trans "Submit" %}"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<p>
|
<p>
|
||||||
{% blocktrans trimmed %}
|
{% blocktrans trimmed %}
|
||||||
If you don't have control over your router, choose not to configure it. To
|
If you don't have control over your router, choose not to configure it. To
|
||||||
see options, to overcome this limitation, choose 'no public address' option
|
see options to overcome this limitation, choose 'no public address' option
|
||||||
in Internet connection type selection.
|
in Internet connection type selection.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -15,9 +15,8 @@
|
|||||||
|
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
|
||||||
<a href='{{ first_boot_next_step }}'>{% trans "skip this step" %}</a>
|
<a href='{{ first_boot_next_step }}'>{% trans "Skip this step" %}</a>
|
||||||
<input type="submit" class="btn btn-primary"
|
<input type="submit" class="btn btn-primary pull-right" value="{% trans "Next" %}"/>
|
||||||
value="{% trans "Next" %}" style="float: right;"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
{{ box_name }} Internet Connectivity
|
{{ box_name }} Internet Connectivity
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% blocktrans trimmed %}
|
{% blocktrans trimmed %}
|
||||||
The following best describes how your {{ box_name }} is connected in your
|
The following best describes how your {{ box_name }} is connected in your
|
||||||
@ -20,15 +21,11 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% blocktrans trimmed %}
|
{% blocktrans trimmed %}
|
||||||
Your {{ box_name }} gets its internet from your Router via WiFi or
|
Your {{ box_name }} gets its Internet from your Router via Wi-Fi or
|
||||||
Ethernet cable. This is a typical home setup.
|
Ethernet cable. This is a typical home setup.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="btn-toolbar">
|
|
||||||
<a href="{% url 'networks:router_setup' %}" class="btn btn-default"
|
<a href="{% url 'networks:router_setup' %}" class="btn btn-default"
|
||||||
role="button" title="{% trans 'Update...' %}">
|
role="button">
|
||||||
<span class="fa" aria-hidden="true"></span>
|
|
||||||
{% trans 'Update...' %}
|
{% trans 'Update...' %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user