47 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
ed92a7e010
networks: Remove unused import to fix flake8 failure
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-25 15:56:12 -08:00
Fioddor Superconcentrado
6e747f281e
networks: Use radio buttons for network modes
Closes: #1974

BTW: Javascript IPV4/6 hide/show arrangements triggered on page load.
Otherwise page loads form fields inconsistently.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Fix the use of RadioSelect widget]
[sunil: Alter the wording of what each type means]
[sunil: Drop the help text for radio group as it is mostly repetitive]
[sunil: js: Make the entire jQuery code run on document ready]
[sunil: js: Revert unneeded double call to change methods, change() is enough]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-25 15:40:45 -08:00
Fioddor Superconcentrado
99935a9696
networks: Change connection type to a radio button
Close: #1821.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Correct the use of RadioSelect widget]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-25 15:40:41 -08:00
Fioddor Superconcentrado
ff9d0ace31
networks: i18n: Mark various strings for translation
Helps: #1938.

- Translate various states passed in by Network Manager:
  - Device state
  - Device state reason
  - Device type
  - Firewall zone
  - IPv4/IPv6 connection method
  - Wireless mode
- forms.py: Move zones list to network.py, reuse in views.py.

Testing:
- Yapf applied.
- Flake8 without errors or warnings for changed files.
- (Unit) tests run without errors.
- Screnshots attached to #1938.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Add strings for many more states]
[sunil: Don't allow None to be selected as firewall zone]
[sunil: Drop forced_literals.py as it reduces modularity of the code]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:12 -07:00
Sunil Mohan Adapa
699266fdc1
help, networks: Clarify i18n different contexts for "Manual"
The word "Manual" means 'user guide' in case of help and 'not automatically' in
case of networking app.

After change, POT file is produced as follows:

msgctxt "User guide"
msgid "Manual"
msgstr ""

msgctxt "Not automatically"
msgid "Manual"
msgstr ""

Closes: #1922.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-08-22 10:52:32 +05:30
James Valleroy
41dc3b4f96
networks: Correct wording of internet connection form
Change "overtime" to "over time", also matches the other choice in the
form.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-06-29 09:47:09 -07:00
Allan Nordhøy
a0f6b0ea4a
networks: Update label wording in topology form: Choose → Specify
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-03-24 15:03:06 -07:00
Nektarios Katakis
3b8308b0cf
networks: Add form for network topology
Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
[sunil: Use the term 'network topology' consistently]
[sunil: Minor grammer fix, and spacing for i18n]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-03-06 14:19:34 -08:00
Sunil Mohan Adapa
b5f6821fd7
networks: Fixes for networks wizards
- Make first wizard steps for router configuration and Internet connection type
private. Since they run after the admin user page, the steps can run for logged
in users.

- Add option to the Internet connection type wizard, to let the user say that
they don't know the type. This allows them to have a stress-free first setup
experience. The option can act as if they have don't have public IP address at
all. This is an extension of the proposed user experience.

- Implement class based views for simplicity.

- Update various IDs for consistency (even though other IDs in the networks
module don't conform).

- Iron out inconsistent terminology. Setup vs Configuration, Help vs. Wizard,
etc.

Tests performed:

- Run first boot wizard from the beginning. Notice that both the wizard steps
appear properly after the user login step (without permission denied problems).
When not logged in, accessing the wizard steps with URL should redirect to login
page.

- During first boot wizard, select 'Skip this step' in both the steps after
selecting non-default options. Values set should be default options as confirmed
from networks page.

- During first boot wizard, select non-default values, the values should be set
properly as confirmed from networks page.

- From the networks page select each value of the wizard. The option should get
saved properly.

- In case of Internet connection type, when the wizard values changes, the
networks page should reflect the value properly. This should also show properly
after skipping the step during first boot.

- During first boot, the default value for Internet connection type should be 'I
don't know' and router configuration should be 'Not configured'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
2020-02-27 20:07:59 +00:00
Sunil Mohan Adapa
3e8ce0c6bd
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>
2020-02-24 12:36:44 -05:00
Sunil Mohan Adapa
1ba55e793f
networks: Fix i18n for wizard forms
- Using Markup on format_lazy objects seems to convert negate their lazy
behavior.

- Extend the format_lazy() utility method to handle markup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-02-24 12:36:41 -05:00
Nektarios Katakis
8134371bbb
networks: Add form for internet connection type
Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-02-24 12:36:15 -05:00
Sunil Mohan Adapa
9368504da5
*.py: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:38:55 +02:00
Veiko Aasa
932d2e17f9
networks: Support virtual Ethernet (veth) devices
Closes #1767

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Add comment and a cosmetic change]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-28 13:13:54 -08:00
James Valleroy
9c33567a54
networks: Update text for router setup
- Move router setup below connections
- Use default style for Update button
- Use box_name in templates
- Add 2nd example of router IP
- Minor updates to text

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-26 17:10:20 -05:00
Nektarios Katakis
ed6cd38c22
networks: save router config to kvstore
Closes: #1695

Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-26 16:02:55 -05:00
Nektarios Katakis
f3d2654a13
networks: form for configuring router
Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-26 16:02:41 -05:00
Alice Kile
eb83e00011
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-07 13:08:35 -05:00
Prachi Srivastava
743d976d50
security: Moves input field focus javascript to django forms
Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 17:39:22 -08:00
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Johannes Keyser
e8f0be1010
i18n: don't use backslash-newline for wrapping long lines in _(), fixes #872 2017-07-10 21:56:46 -04:00
Sunil Mohan Adapa
dce51fd6d7
networks: Support configuring IPv6 networks
- Very similar to configuration of IPv4 networks.

- Supports 'auto', 'dhcp', 'manual' and 'ignored' modes as supported by
  network manager.  'shared' mode is not yet implemented by network
  manager.
2016-10-01 07:09:03 -04:00
Sunil Mohan Adapa
28a9933fd9
networks: Configure wireless BSSID, band, channel
Select the frequency band (2.4 GHz vs. 5 GHz) is a prerequisite for
selecting the channel.  Channel selection is useful primarily as follow:

- Restrict to a particular access point when multiple access points use
  the same SSID (AP name) but are available on different frequencies.

- Configure for a particular ad-hoc mesh network.

- Setup multiple access points from a single FreedomBox on multiple
  channels to maximize the throughput and number of simultaneous
  clients.

Ability to specify a particular BSSID will help associate with a
particular access point when multiple access points use the same
SSID (AP name).  This is also makes it slightly harder to trick clients
into connection to a malicious device.  Also configuring BATMAN-adv
seems to require setting a particular BSSID.
2016-07-21 19:23:31 -04:00
Sunil Mohan Adapa
a9ca2d7cc3
networks: Add 'disabled' IPv4 method, i18n
Disabled IPv4 method allows not configuring IPv4 entirely on network
interfaces as required in some cases.

Also, make sure to internationalize all the choices form values in
network module.  There were missed before.
2016-07-21 19:23:27 -04:00
Sunil Mohan Adapa
04babacafa
networks: Ability to configure generic interfaces
After batman-adv kernel driver takes over the Wi-Fi network interface
and provides a bat0 interface, this interface shows up as device type
'batadv'.  This type is not recognized by network manager is dealt with
as a generic device.  Configuring this device for IPv4/IPv6 in
auto/shared mode etc. works fine.  So, add the ability to configure
generic interfaces.
2016-07-21 19:23:20 -04:00
Sunil Mohan Adapa
4f634b86e2
networks: Better explain auto/shared connections 2016-06-07 08:12:25 -04:00
Sunil Mohan Adapa
4865a64d2b
networks: Allow shared connections to have IPs
Setting IP address on a shared connection can be usefull.  This tells
Network Manager to pick the provided network range (inferred from
IP/netmask) instead of something in 10.42.x.x.  This can be used to give
predicatable IPs, static IPs and to make large static
reservations (instead of the default 8).
2016-06-07 08:12:18 -04:00
Sunil Mohan Adapa
42d0198a2e networks: Refactor for simplicity and brevity
- Make connection adding/editing forms inherit from base.

- Make the forms responsible for extracting cleaned data.

- Use dictionaries for passing around settings values while
  adding/editing connections.
2015-12-09 17:56:11 +05:30
Sunil Mohan Adapa
d1b20ac113 networks: I18N for static IP configuration 2015-12-09 12:20:37 +05:30
Daniel Steglich
1a1faa8a1b Github issue 314: static IP configuration enhancement
* fixed IP configuration
  * set up a new ipv4settings object to avoid the need of reseting all the values
* extended Static IP configuration:
  * allow configuration of netmask (optional)
  * allow configuration of Gateway (optional)
  * allow configuartion of two DNS Servers (optional)
* extend DHCP configuration:
  * allow configuration of user specific DNS Server
  * DHCP provided DNS Servers will be ignored in that case
2015-12-09 10:28:53 +05:30
Sunil Mohan Adapa
cc858bbd6a Use pgi only when gi is not available
- Write a convenience utility to handle the import process.
2015-11-16 09:55:20 +05:30
Nik Nyby
608897b9ec Test on python 3.3 and 3.4 with travis
Python 3.2.x is deprecated, so I thought it would be
good to get tests running on some newer pythons. I've
switched from the python3-gi package to using 'pgi' from
pypi, because the apt-installed python3-gi was having trouble
importing.

pgi required python 3.3+ (see: https://pypi.python.org/pypi/pgi),
so I've removed python 3.2 from the test matrix. Let me know if
we're using python 3.2 anywhere, but as far as I know plinth is
run on python 3.4.3 with debian sid on the freedombox image.
2015-11-16 08:44:01 +05:30
Sunil Mohan Adapa
3df1a88824 Switch to Django i18n for code strings
Django i18n layer is on top of gettext and provide may crucial features
such as per-request locales, lazy translations etc.
2015-11-13 22:08:43 +05:30
Sunil Mohan Adapa
2ef22ec1b4 Require library version for GObject introspection
Specify the version of a library before importing it using GObject
introspection.  Mainly to avoid warnings with recent version of
pygobject.  Closes #247.
2015-10-17 21:13:35 -04:00
Sunil Mohan Adapa
ef156dab91 networks: Minor styling and comments update
- Add comment about PPP peers possibly not responding to echo requests.
2015-08-22 21:14:21 +05:30
Sunil Mohan Adapa
958c249dfb networks: Retrieve password while editing PPPoE
- Retrieve password using connection.get_secrets() instead of
  settings_pppoe.get_password().

- Make sure IPv4 settings are not accessed during PPPoE editing.
2015-08-22 21:10:56 +05:30
Sunil Mohan Adapa
4f75f44769 networks: Fix showing password during PPPoE edit
- Javascript was missing for the template altogether.  Added one similar
  to create case.

- Minor refactoring to existing javascript.

- Consistent styling for display label and field id.
2015-08-22 20:22:08 +05:30
Daniel Steglich
d79437d2a2 show / hide password box
Added a selectbox to change the input box type from password to text.
2015-08-22 13:03:00 +05:30
Daniel Steglich
286caf8917 Added a new network connection type to handle PPPoE connections
* Added a new choice to main selectbox for adding Network Connections (network.py)
* Added a new form which asks for name, interface, firewall zone, username and password (forms.py, urls.py)
* Added new helper functions to create PPPoE based connection object (network.py)
2015-08-22 13:03:00 +05:30
Sunil Mohan Adapa
acf3a919f6 networks: Improvements to interface binding
- Fetch network interfaces list at the time of form creation instead of
  during definition.

- Add help text to interfaces list choice field.

- Don't write an explict check for requiring interface
  selection. required=True, which is default, takes care of that.

- Internationalize the empty selection text.

- Update the empty selection text.

- Re-order interface parameter in the same order of priority/appearance.
2015-07-27 22:03:02 +05:30
Daniel Steglich
378d6b8d84 networks: Always bind connections to a device 2015-07-27 22:03:02 +05:30
Sunil Mohan Adapa
0cb8b4a5fc network: Cleanup, minor fixes and refactoring
- Make network-manager package get installed when accessing the index page of
  networks.  Also freedombox-setup shold actually pull network-manager package
  as dependency and use it for configuring the initial networks.

- Remove the /connect page and re-use the /add_wifi page for that purpose.

- Fix add connection page titles.

- Handle the case when network-manager returned empty string for SSID.

- Don't explictly URL encode the Wi-Fi SSID when adding a new Wi-Fi network.
  Django automatically handles this in 'url' tag and decodes before url
  routing.  Relax the regex that matches SSID as part of the URL to handle all
  possible SSIDs.
2015-04-06 22:21:29 +05:30
James Valleroy
2441caf647 Add AP and adhoc wifi modes, and shared IPv4 addressing mode. 2015-04-06 22:21:29 +05:30
James Valleroy
8d9b388375 Fix network tests, add form help and validator. 2015-04-06 22:21:29 +05:30
James Valleroy
45086ff003 Add firewall zone selection for networks. 2015-04-06 22:21:29 +05:30
James Valleroy
f0c5cd080c Add wifi security settings. 2015-04-06 22:21:29 +05:30
James Valleroy
9b201a2daf Rename network module to networks.
Move networkmanager helper functions into a new file.
Add some network tests.
2015-04-06 22:21:28 +05:30