Removed redirection for login and help urls

Changed the redirection in state0 template
This commit is contained in:
Hemanth Kumar Veeranki authored and James Valleroy committed 2016-11-03 22:06:05 -04:00
1 parent 0332d4489e
commit 0290f68ae6
5 files changed
+25 -10

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ first_boot_steps = [{'id': 'firstboot_state0',
'url': 'first_boot:state0',
'order': 0
},
{'id': 'firstboot_state10',
{'id': 'firstboot_state10',
'url': 'first_boot:state10',
'order': 10
}
+11 -5
View File
@@ -22,6 +22,7 @@ yet.
from django.http.response import HttpResponseRedirect
from django.urls import reverse
from django.conf import settings
import logging
from operator import itemgetter
from plinth import kvstore, module_loader
@@ -38,11 +39,15 @@ class FirstBootMiddleware(object):
"""Handle a request as Django middleware request handler."""
state = kvstore.get_default('firstboot_state', 0)
user_requests_firstboot = is_firstboot(request.path)
if state == 1 and user_requests_firstboot:
return HttpResponseRedirect(reverse('index'))
elif state == 0 and not user_requests_firstboot:
url = next_step()
return HttpResponseRedirect(reverse(url))
user_requests_login = request.path.startswith(reverse(settings.LOGIN_URL))
help_index_url = reverse('help:index')
user_requests_help = request.path.startswith(help_index_url)
if not user_requests_login and not user_requests_help:
if state == 1 and user_requests_firstboot:
return HttpResponseRedirect(reverse('index'))
elif state == 0 and not user_requests_firstboot:
url = next_step()
return HttpResponseRedirect(reverse(url))
def is_firstboot(path):
@@ -59,6 +64,7 @@ def is_firstboot(path):
def get_firstboot_steps():
"""Returns all firstboot steps"""
steps = []
modules = module_loader.loaded_modules
for (module_name, module_object) in modules.items():
@@ -37,7 +37,7 @@
</p>
<p class="text-center">
<a href="{% url 'first_boot:state1' %}"
<a href="{% url next_url %}"
class="btn btn-primary btn-lg">{% trans "Start Setup" %}</a>
</p>
+9 -2
View File
@@ -28,14 +28,21 @@ from plinth import kvstore
from plinth import network
from plinth.errors import DomainRegistrationError
from .forms import State1Form, State5Form
from .middleware import mark_step_done
from .middleware import mark_step_done, next_step
class State0View(TemplateView):
"""Show the welcome screen."""
kvstore.set('firstboot_state0', 'done')
template_name = 'firstboot_state0.html'
def get_context_data(self, **kwargs):
"""Returns the context data"""
context = super(State0View, self).get_context_data(**kwargs)
mark_step_done('firstboot_state0')
context['next_url'] = next_step()
return context
def state10(request):
"""State 10 is when all firstboot setup is done.