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()