From 62185a5960206b301bd50cf67ce1c02dd17bc48d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 13 Oct 2015 21:26:14 +0530 Subject: [PATCH] first_boot: Don't ask for a new hostname - Setting a new hostname is not one of the most buring issues to be take care of during the setup process. - Also, most likely the user will access the FreedomBox machine using mDNS hostname such as freedombox.local. Changing the hostname mid setup might have consequences that need to thought about properly. --- plinth/modules/first_boot/forms.py | 23 +++++++---------------- plinth/modules/first_boot/views.py | 7 +------ 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/plinth/modules/first_boot/forms.py b/plinth/modules/first_boot/forms.py index 118d52e8c..79afd82be 100644 --- a/plinth/modules/first_boot/forms.py +++ b/plinth/modules/first_boot/forms.py @@ -15,9 +15,12 @@ # along with this program. If not, see . # +""" +Forms for first boot module. +""" + from django import forms from django.contrib import auth, messages -from django.core import validators from gettext import gettext as _ from plinth import actions @@ -27,25 +30,14 @@ from plinth.modules.users.forms import GROUP_CHOICES class State0Form(forms.ModelForm): - """Firstboot state 0: Set hostname and create a new user""" - hostname = forms.CharField( - label=_('Name of your FreedomBox'), - help_text=_('For convenience, your FreedomBox needs a name. It \ -should be something short that does not contain spaces or punctuation. \ -"Willard" would be a good name while "Freestyle McFreedomBox!!!" would \ -not. It must be alphanumeric, start with an alphabet and must not be greater \ -than 63 characters in length.'), - validators=[ - validators.RegexValidator(r'^[a-zA-Z][a-zA-Z0-9]{,62}$', - _('Invalid hostname'))]) - + """Firstboot state 0: create a new user.""" def __init__(self, *args, **kwargs): self.request = kwargs.pop('request') super(State0Form, self).__init__(*args, **kwargs) class Meta: model = auth.models.User - fields = ('hostname', 'username', 'password') + fields = ('username', 'password') widgets = { 'password': forms.PasswordInput, } @@ -58,8 +50,7 @@ than 63 characters in length.'), } def save(self, commit=True): - """Set hostname, create and login the user""" - config.set_hostname(self.cleaned_data['hostname']) + """Create and log the user in.""" user = super(State0Form, self).save(commit=False) user.set_password(self.cleaned_data['password']) if commit: diff --git a/plinth/modules/first_boot/views.py b/plinth/modules/first_boot/views.py index ffc7e622c..ccdcac732 100644 --- a/plinth/modules/first_boot/views.py +++ b/plinth/modules/first_boot/views.py @@ -28,16 +28,11 @@ from .forms import State0Form class State0View(CreateView): - """Setup hostname and create user account""" + """Create user account and log the user in.""" template_name = 'firstboot_state0.html' form_class = State0Form success_url = reverse_lazy('first_boot:state10') - def get_initial(self): - initial = super(State0View, self).get_initial() - initial['hostname'] = config.get_hostname() - return initial - def get_form_kwargs(self): """Make request available to the form (to insert messages)""" kwargs = super(State0View, self).get_form_kwargs()