mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-10 11:00:22 +00:00
- Remove the need to pass all the individual information elements to the AppView separately. This eliminates many issues with elements that were mistakenly not sent to AppView. Also reduces a lot of code duplication. - Create App classes for power and sso for consistency. Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
#
|
|
# This file is part of FreedomBox.
|
|
#
|
|
# 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/>.
|
|
#
|
|
from django.contrib import messages
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from plinth import actions
|
|
from plinth.modules.mumble import port_forwarding_info
|
|
from plinth.modules.mumble.forms import MumbleForm
|
|
from plinth.views import AppView
|
|
|
|
|
|
class MumbleAppView(AppView):
|
|
app_id = 'mumble'
|
|
port_forwarding_info = port_forwarding_info
|
|
form_class = MumbleForm
|
|
|
|
def form_valid(self, form):
|
|
"""Apply new superuser password if it exists"""
|
|
new_config = form.cleaned_data
|
|
|
|
password = new_config.get('super_user_password')
|
|
if password:
|
|
actions.run_as_user(
|
|
'mumble',
|
|
['create-password'],
|
|
input=password.encode(),
|
|
become_user="mumble-server",
|
|
)
|
|
messages.success(self.request,
|
|
_('SuperUser password successfully updated.'))
|
|
|
|
return super().form_valid(form)
|