mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
wi-fi network connection: Fixed error message when entering the form
- When selecting an existing WiFi on the "scan" page, the user will be redirected to the "WiFi add" form. This form did not contain a WiFi capable Interface as default selection, for this reason the user get a invalid form message when entering the form.
This commit is contained in:
parent
3c47dfb6ef
commit
408aa8910a
@ -360,7 +360,9 @@ def add_wifi(request, ssid=None):
|
|||||||
form_data = None
|
form_data = None
|
||||||
|
|
||||||
if ssid:
|
if ssid:
|
||||||
|
device = network.get_first_wifi_device()
|
||||||
form_data = {'name': ssid,
|
form_data = {'name': ssid,
|
||||||
|
'interface': device,
|
||||||
'zone': 'external',
|
'zone': 'external',
|
||||||
'ssid': ssid,
|
'ssid': ssid,
|
||||||
'mode': 'infrastructure',
|
'mode': 'infrastructure',
|
||||||
|
|||||||
@ -76,6 +76,17 @@ def get_interface_list(device_type):
|
|||||||
return interfaces
|
return interfaces
|
||||||
|
|
||||||
|
|
||||||
|
def get_first_wifi_device():
|
||||||
|
"""Get a list of network interface available on the system."""
|
||||||
|
interface = "empty"
|
||||||
|
for device in nm.Client.new(None).get_devices():
|
||||||
|
if device.get_device_type() == nm.DeviceType.WIFI:
|
||||||
|
interface = device.get_iface()
|
||||||
|
return interface
|
||||||
|
|
||||||
|
return interface
|
||||||
|
|
||||||
|
|
||||||
def get_ip_from_device(devicename):
|
def get_ip_from_device(devicename):
|
||||||
"""
|
"""
|
||||||
Get the first ip address from the network interface.
|
Get the first ip address from the network interface.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user