diff --git a/plinth/modules/first_boot/__init__.py b/plinth/modules/first_boot/__init__.py index 77e6948df..3653b5ce2 100644 --- a/plinth/modules/first_boot/__init__.py +++ b/plinth/modules/first_boot/__init__.py @@ -25,13 +25,13 @@ is_essential = True first_boot_steps = [ { - 'id': 'firstboot_state0', - 'url': 'first_boot:state0', + 'id': 'firstboot_welcome', + 'url': 'first_boot:welcome', 'order': 0 }, { - 'id': 'firstboot_state10', - 'url': 'first_boot:state10', + 'id': 'firstboot_complete', + 'url': 'first_boot:complete', 'order': 10 } ] diff --git a/plinth/modules/first_boot/templates/firstboot_state10.html b/plinth/modules/first_boot/templates/firstboot_complete.html similarity index 100% rename from plinth/modules/first_boot/templates/firstboot_state10.html rename to plinth/modules/first_boot/templates/firstboot_complete.html diff --git a/plinth/modules/first_boot/templates/firstboot_state0.html b/plinth/modules/first_boot/templates/firstboot_welcome.html similarity index 100% rename from plinth/modules/first_boot/templates/firstboot_state0.html rename to plinth/modules/first_boot/templates/firstboot_welcome.html diff --git a/plinth/modules/first_boot/urls.py b/plinth/modules/first_boot/urls.py index 6c41de5ed..93fe8364f 100644 --- a/plinth/modules/first_boot/urls.py +++ b/plinth/modules/first_boot/urls.py @@ -22,12 +22,13 @@ URLs for the First Boot module from django.conf.urls import url from stronghold.decorators import public -from .views import State0View, state10 +from .views import WelcomeView, complete urlpatterns = [ # Take care of the firstboot middleware when changing URLs - url(r'^firstboot/$', public(State0View.as_view()), name='index'), - url(r'^firstboot/state0/$', public(State0View.as_view()), name='state0'), - url(r'^firstboot/state10/$', state10, name='state10'), + url(r'^firstboot/$', public(WelcomeView.as_view()), name='index'), + url(r'^firstboot/welcome/$', public(WelcomeView.as_view()), + name='welcome'), + url(r'^firstboot/complete/$', complete, name='complete'), ] diff --git a/plinth/modules/first_boot/views.py b/plinth/modules/first_boot/views.py index 37546127a..1aae217c4 100644 --- a/plinth/modules/first_boot/views.py +++ b/plinth/modules/first_boot/views.py @@ -23,30 +23,30 @@ from plinth import network from .middleware import mark_step_done, next_step -class State0View(TemplateView): +class WelcomeView(TemplateView): """Show the welcome screen.""" - template_name = 'firstboot_state0.html' + template_name = 'firstboot_welcome.html' def get_context_data(self, **kwargs): """Returns the context data for the template.""" - context = super(State0View, self).get_context_data(**kwargs) - mark_step_done('firstboot_state0') + context = super(WelcomeView, self).get_context_data(**kwargs) + mark_step_done('firstboot_welcome') context['next_url'] = next_step() return context -def state10(request): - """State 10 is when all firstboot setup is done. +def complete(request): + """Show summary after all firstboot setup is done. After viewing this page the firstboot module can't be accessed anymore. """ # Make sure that a user exists before finishing firstboot if User.objects.all(): - mark_step_done('firstboot_state10') + mark_step_done('firstboot_complete') connections = network.get_connection_list() - return render(request, 'firstboot_state10.html', + return render(request, 'firstboot_complete.html', {'title': _('Setup Complete'), 'connections': connections}) diff --git a/plinth/modules/pagekite/forms.py b/plinth/modules/pagekite/forms.py index b41266bac..4847f4bca 100644 --- a/plinth/modules/pagekite/forms.py +++ b/plinth/modules/pagekite/forms.py @@ -263,7 +263,7 @@ class AddCustomServiceForm(BaseCustomServiceForm): raise -class State5Form(forms.Form): +class FirstBootForm(forms.Form): """Set up freedombox.me pagekite subdomain""" DOMAIN_APPENDIX = '.freedombox.me' # Webservice url for domain validation and registration diff --git a/plinth/modules/pagekite/templates/firstboot_state5.html b/plinth/modules/pagekite/templates/pagekite_firstboot.html similarity index 93% rename from plinth/modules/pagekite/templates/firstboot_state5.html rename to plinth/modules/pagekite/templates/pagekite_firstboot.html index 18652d10c..7c34c7a89 100644 --- a/plinth/modules/pagekite/templates/firstboot_state5.html +++ b/plinth/modules/pagekite/templates/pagekite_firstboot.html @@ -27,7 +27,7 @@
- {% url 'first_boot:state10' as finish_firstboot_url %} + {% url 'first_boot:complete' as finish_firstboot_url %} {% blocktrans trimmed %} Skip this step if you do not have a voucher or want to configure PageKite later with a @@ -54,7 +54,7 @@ - {% trans "Skip Registration" %} diff --git a/plinth/modules/pagekite/urls.py b/plinth/modules/pagekite/urls.py index bb1508193..d3bf6194d 100644 --- a/plinth/modules/pagekite/urls.py +++ b/plinth/modules/pagekite/urls.py @@ -22,7 +22,7 @@ URLs for the PageKite module from django.conf.urls import url from .views import StandardServiceView, CustomServiceView, ConfigurationView, \ - DeleteServiceView, index, State5View + DeleteServiceView, index, FirstBootView urlpatterns = [ url(r'^sys/pagekite/$', index, name='index'), @@ -34,5 +34,6 @@ urlpatterns = [ name='custom-services'), url(r'^sys/pagekite/services/custom/delete$', DeleteServiceView.as_view(), name='delete-custom-service'), - url(r'^sys/pagekite/firstboot/$', State5View.as_view(), name='firstboot'), + url(r'^sys/pagekite/firstboot/$', FirstBootView.as_view(), + name='firstboot'), ] diff --git a/plinth/modules/pagekite/views.py b/plinth/modules/pagekite/views.py index 41621af26..c6ec4cb8e 100644 --- a/plinth/modules/pagekite/views.py +++ b/plinth/modules/pagekite/views.py @@ -25,7 +25,7 @@ from django.views.generic.edit import FormView from . import utils from .forms import ConfigurationForm, StandardServiceForm, \ - AddCustomServiceForm, DeleteCustomServiceForm, State5Form + AddCustomServiceForm, DeleteCustomServiceForm, FirstBootForm from plinth.errors import DomainRegistrationError from plinth.modules import pagekite from plinth.modules.first_boot.middleware import mark_step_done @@ -134,15 +134,15 @@ class ConfigurationView(ContextMixin, FormView): return super(ConfigurationView, self).form_valid(form) -class State5View(FormView): - """State 5 is the (optional) setup of the Pagekite subdomain.""" - template_name = 'firstboot_state5.html' - form_class = State5Form +class FirstBootView(FormView): + """First boot (optional) setup of the Pagekite subdomain.""" + template_name = 'pagekite_firstboot.html' + form_class = FirstBootForm def get(self, *args, **kwargs): """Respond to GET request.""" mark_step_done('pagekite_firstboot') - return super(State5View, self).get(*args, **kwargs) + return super(FirstBootView, self).get(*args, **kwargs) def form_valid(self, form): """Act on valid form submission.""" @@ -156,4 +156,4 @@ class State5View(FormView): message = _('Pagekite setup finished. The HTTP and HTTPS services ' 'are activated now.') messages.success(self.request, message) - return super(State5View, self).form_valid(form) + return super(FirstBootView, self).form_valid(form) diff --git a/plinth/modules/users/forms.py b/plinth/modules/users/forms.py index b6b62bcf9..a389d17c7 100644 --- a/plinth/modules/users/forms.py +++ b/plinth/modules/users/forms.py @@ -245,8 +245,8 @@ class UserChangePasswordForm(SetPasswordForm): return user -class State1Form(ValidNewUsernameCheckMixin, auth.forms.UserCreationForm): - """Firstboot state 1: create a new user.""" +class FirstBootForm(ValidNewUsernameCheckMixin, auth.forms.UserCreationForm): + """User module first boot step: create a new admin user.""" def __init__(self, *args, **kwargs): self.request = kwargs.pop('request') diff --git a/plinth/modules/users/templates/firstboot_state1.html b/plinth/modules/users/templates/users_firstboot.html similarity index 100% rename from plinth/modules/users/templates/firstboot_state1.html rename to plinth/modules/users/templates/users_firstboot.html diff --git a/plinth/modules/users/urls.py b/plinth/modules/users/urls.py index 7cd438ae1..442f5e32a 100644 --- a/plinth/modules/users/urls.py +++ b/plinth/modules/users/urls.py @@ -41,5 +41,6 @@ urlpatterns = [ {'template_name': 'login.html'}, name='login'), url(r'^accounts/logout/$', auth_views.logout, {'next_page': reverse_lazy('index')}, name='logout'), - url(r'^users/firstboot/$', public(views.State1View.as_view()), name='firstboot'), + url(r'^users/firstboot/$', public(views.FirstBootView.as_view()), + name='firstboot'), ] diff --git a/plinth/modules/users/views.py b/plinth/modules/users/views.py index 613c4c100..b5edea64d 100644 --- a/plinth/modules/users/views.py +++ b/plinth/modules/users/views.py @@ -26,7 +26,7 @@ import django.views.generic from django.utils.translation import ugettext as _, ugettext_lazy from .forms import CreateUserForm, UserChangePasswordForm, UserUpdateForm, \ - State1Form + FirstBootForm from plinth import actions from plinth import cfg from plinth.errors import ActionError @@ -168,10 +168,10 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView): return super(UserChangePassword, self).form_valid(form) -class State1View(django.views.generic.CreateView): +class FirstBootView(django.views.generic.CreateView): """Create user account and log the user in.""" - template_name = 'firstboot_state1.html' - form_class = State1Form + template_name = 'users_firstboot.html' + form_class = FirstBootForm success_url = '' def __init__(self, *args, **kwargs): @@ -181,10 +181,10 @@ class State1View(django.views.generic.CreateView): mark_step_done('users_firstboot') self.success_url = next_step() - return super(State1View, self).__init__(*args, **kwargs) + return super(FirstBootView, self).__init__(*args, **kwargs) def get_form_kwargs(self): """Make request available to the form (to insert messages)""" - kwargs = super(State1View, self).get_form_kwargs() + kwargs = super(FirstBootView, self).get_form_kwargs() kwargs['request'] = self.request return kwargs