mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
networks: save router config to kvstore
Closes: #1695 Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
33f5114241
commit
ed6cd38c22
3 files changed
+14
-5
No files matched your search
@@ -54,6 +54,8 @@ manual_page = 'Networks'
|
||||
|
||||
app = None
|
||||
|
||||
ROUTER_CONFIGURATION_TYPE_KEY = 'networks_router_configuration_type'
|
||||
|
||||
|
||||
class NetworksApp(app_module.App):
|
||||
"""FreedomBox app for Networks."""
|
||||
|
||||
@@ -306,7 +306,6 @@ class RouterConfigurationWizardForm(forms.Form):
|
||||
future suggestions during the setup process and other apps.
|
||||
"""
|
||||
router_config = forms.ChoiceField(
|
||||
initial='dmz',
|
||||
label=_('Preferred router configuration'),
|
||||
choices=[
|
||||
(
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from logging import Logger
|
||||
import logging
|
||||
|
||||
from django.contrib import messages
|
||||
from django.shortcuts import redirect
|
||||
@@ -24,13 +24,13 @@ from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from plinth import network
|
||||
from plinth import network, kvstore
|
||||
from plinth.modules import networks, first_boot
|
||||
|
||||
from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
|
||||
PPPoEForm, WifiForm, RouterConfigurationWizardForm)
|
||||
|
||||
logger = Logger(__name__)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def index(request):
|
||||
@@ -426,7 +426,15 @@ def router_configuration_help_page(request):
|
||||
is_firstboot = True \
|
||||
if 'firstboot' in request.build_absolute_uri() else False
|
||||
|
||||
if request.method == "POST":
|
||||
if request.method == 'POST' and request.POST['router_config']:
|
||||
form = RouterConfigurationWizardForm(request.POST)
|
||||
if form.is_valid():
|
||||
logger.info('Updating router configuration setup with value: %s' %
|
||||
request.POST['router_config'])
|
||||
kvstore.set(
|
||||
networks.ROUTER_CONFIGURATION_TYPE_KEY,
|
||||
request.POST['router_config']
|
||||
)
|
||||
if is_firstboot:
|
||||
resp = reverse_lazy(first_boot.next_step())
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user