From 0fdc0ffe52362922e9cec4eaec4d8e1d76f5dbaa Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Wed, 30 Nov 2016 21:22:42 -0500 Subject: [PATCH] users: Fix marking first boot step as done --- plinth/modules/users/forms.py | 3 +++ plinth/modules/users/views.py | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/plinth/modules/users/forms.py b/plinth/modules/users/forms.py index a389d17c7..38ef40eb9 100644 --- a/plinth/modules/users/forms.py +++ b/plinth/modules/users/forms.py @@ -27,6 +27,7 @@ from django.utils.translation import ugettext as _, ugettext_lazy from plinth import actions from plinth.errors import ActionError +from plinth.modules import first_boot from plinth.modules.security import set_restricted_access # Usernames used by optional services (that might not be installed yet). @@ -256,6 +257,8 @@ class FirstBootForm(ValidNewUsernameCheckMixin, auth.forms.UserCreationForm): """Create and log the user in.""" user = super().save(commit=commit) if commit: + first_boot.mark_step_done('users_firstboot') + try: actions.superuser_run( 'ldap', diff --git a/plinth/modules/users/views.py b/plinth/modules/users/views.py index dfe92b90c..e90e30911 100644 --- a/plinth/modules/users/views.py +++ b/plinth/modules/users/views.py @@ -179,13 +179,6 @@ class FirstBootView(django.views.generic.CreateView): kwargs['request'] = self.request return kwargs - def form_valid(self, form): - """Mark this first boot step as completed and save form.""" - if User.objects.all(): - first_boot.mark_step_done('users_firstboot') - - return super().form_valid(form) - def get_success_url(self): """Return the next first boot step after valid form submission.""" return reverse(first_boot.next_step())