mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
first_boot: Add separate greeting page
This commit is contained in:
parent
23eb40fce8
commit
f3a0c70d23
@ -28,15 +28,15 @@ from plinth.errors import ActionError
|
|||||||
from plinth.modules.users.forms import GROUP_CHOICES
|
from plinth.modules.users.forms import GROUP_CHOICES
|
||||||
|
|
||||||
|
|
||||||
class State0Form(auth.forms.UserCreationForm):
|
class State1Form(auth.forms.UserCreationForm):
|
||||||
"""Firstboot state 0: create a new user."""
|
"""Firstboot state 1: create a new user."""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.request = kwargs.pop('request')
|
self.request = kwargs.pop('request')
|
||||||
super(State0Form, self).__init__(*args, **kwargs)
|
super(State1Form, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
"""Create and log the user in."""
|
"""Create and log the user in."""
|
||||||
user = super(State0Form, self).save(commit=commit)
|
user = super(State1Form, self).save(commit=commit)
|
||||||
if commit:
|
if commit:
|
||||||
try:
|
try:
|
||||||
actions.superuser_run(
|
actions.superuser_run(
|
||||||
|
|||||||
@ -21,32 +21,39 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% load bootstrap %}
|
{% load bootstrap %}
|
||||||
|
|
||||||
{% block content %}
|
{% block page_head %}
|
||||||
|
<style type="text/css">
|
||||||
<h2>Welcome to Your FreedomBox!</h2>
|
.navbar-brand {
|
||||||
|
display: none;
|
||||||
<p>It looks like this {{ cfg.box_name }} isn't set up yet. Provide basic
|
}
|
||||||
data to get started.</p>
|
</style>
|
||||||
|
|
||||||
<p>Choose a username and password to access this web interface. The
|
|
||||||
password can be changed and other users can be added later. An
|
|
||||||
LDAP user with administrative privileges (sudo) is also created.</p>
|
|
||||||
|
|
||||||
<form class="form" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
{{ form|bootstrap }}
|
|
||||||
<input type="submit" class="btn btn-primary" value="Box it up!"/>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block add_nav_and_login %}
|
||||||
{% include "firstboot_sidebar.html" %}
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'help:index' %}">
|
||||||
|
<span class="glyphicon-question-sign glyphicon nav-icon"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block page_js %}
|
{% block content_row %}
|
||||||
<script>
|
<p class="text-center">
|
||||||
$('#id_hostname').focus();
|
<img src="{% static 'theme/img/FreedomBox-logo-standard.png' %}"
|
||||||
</script>
|
alt="FreedomBox" width="640"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3 class="text-center">
|
||||||
|
Congratulations! Your FreedomBox is up and running!
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<p class="text-center">Please provide the following basic
|
||||||
|
information to complete the setup process.</p>
|
||||||
|
|
||||||
|
<p class="text-center">
|
||||||
|
<a href="{% url 'first_boot:state1' %}"
|
||||||
|
class="btn btn-primary btn-large">Next</a>
|
||||||
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
49
plinth/modules/first_boot/templates/firstboot_state1.html
Normal file
49
plinth/modules/first_boot/templates/firstboot_state1.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% comment %}
|
||||||
|
#
|
||||||
|
# This file is part of Plinth.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
{% load static %}
|
||||||
|
{% load bootstrap %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h2>Administrator Account</h2>
|
||||||
|
|
||||||
|
<p>Choose a username and password to access this web interface. The
|
||||||
|
password can be changed and other users can be added later. An
|
||||||
|
LDAP user with administrative privileges (sudo) is also created.</p>
|
||||||
|
|
||||||
|
<form class="form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|bootstrap }}
|
||||||
|
<input type="submit" class="btn btn-primary" value="Box it up!"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
{% include "firstboot_sidebar.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_js %}
|
||||||
|
<script>
|
||||||
|
$('#id_hostname').focus();
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
@ -22,7 +22,7 @@ URLs for the First Boot module
|
|||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
from stronghold.decorators import public
|
from stronghold.decorators import public
|
||||||
|
|
||||||
from .views import State0View
|
from .views import State0View, State1View
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
@ -30,5 +30,6 @@ urlpatterns = patterns( # pylint: disable-msg=C0103
|
|||||||
# Take care of the firstboot middleware when changing URLs
|
# Take care of the firstboot middleware when changing URLs
|
||||||
url(r'^firstboot/$', public(State0View.as_view()), name='index'),
|
url(r'^firstboot/$', public(State0View.as_view()), name='index'),
|
||||||
url(r'^firstboot/state0/$', public(State0View.as_view()), name='state0'),
|
url(r'^firstboot/state0/$', public(State0View.as_view()), name='state0'),
|
||||||
|
url(r'^firstboot/state1/$', public(State1View.as_view()), name='state1'),
|
||||||
url(r'^firstboot/state10/$', 'state10', name='state10'),
|
url(r'^firstboot/state10/$', 'state10', name='state10'),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -19,23 +19,27 @@ from django.contrib.auth.models import User
|
|||||||
from django.core.urlresolvers import reverse_lazy
|
from django.core.urlresolvers import reverse_lazy
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic import CreateView, TemplateView
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
from plinth import kvstore
|
from plinth import kvstore
|
||||||
from plinth.modules.config import config
|
from .forms import State1Form
|
||||||
from .forms import State0Form
|
|
||||||
|
|
||||||
|
|
||||||
class State0View(CreateView):
|
class State0View(TemplateView):
|
||||||
"""Create user account and log the user in."""
|
"""Show the welcome screen."""
|
||||||
template_name = 'firstboot_state0.html'
|
template_name = 'firstboot_state0.html'
|
||||||
form_class = State0Form
|
|
||||||
|
|
||||||
|
class State1View(CreateView):
|
||||||
|
"""Create user account and log the user in."""
|
||||||
|
template_name = 'firstboot_state1.html'
|
||||||
|
form_class = State1Form
|
||||||
success_url = reverse_lazy('first_boot:state10')
|
success_url = reverse_lazy('first_boot:state10')
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
"""Make request available to the form (to insert messages)"""
|
"""Make request available to the form (to insert messages)"""
|
||||||
kwargs = super(State0View, self).get_form_kwargs()
|
kwargs = super(State1View, self).get_form_kwargs()
|
||||||
kwargs['request'] = self.request
|
kwargs['request'] = self.request
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
|||||||
@ -144,33 +144,35 @@
|
|||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
{% block content_row %}
|
||||||
{% block submenu %}
|
<div class="col-md-3">
|
||||||
{% if submenu %}
|
{% block submenu %}
|
||||||
<div class="sidebar">
|
{% if submenu %}
|
||||||
{% include "submenu.html" with menu=submenu %}
|
<div class="sidebar">
|
||||||
</div><!--/.sidebar -->
|
{% include "submenu.html" with menu=submenu %}
|
||||||
{% endif %}
|
</div><!--/.sidebar -->
|
||||||
{% endblock %}
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{# this sidebar should contain help texts but no menus #}
|
{# this sidebar should contain help texts but no menus #}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
{% block subsubmenu %}
|
{% block subsubmenu %}
|
||||||
{% if subsubmenu %}
|
{% if subsubmenu %}
|
||||||
{% show_subsubmenu subsubmenu %}
|
{% show_subsubmenu subsubmenu %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% include 'messages.html' %}
|
{% include 'messages.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{# main content goes here #}
|
{# main content goes here #}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div><!--/col-->
|
</div><!--/col-->
|
||||||
|
{% endblock %}
|
||||||
</div><!--/row-->
|
</div><!--/row-->
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user