mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
Add char field to set a password that is required to join the server
Reviewed-by: James Valleroy <jvalleroy@mailbox.org> [james: Apply yapf formatting] [james: Minor adjustment to help text] Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
a7c9248200
commit
7028e3d022
@ -39,6 +39,10 @@ def parse_arguments():
|
|||||||
subparsers.add_parser('get-root-channel-name',
|
subparsers.add_parser('get-root-channel-name',
|
||||||
help='Print the root channel name')
|
help='Print the root channel name')
|
||||||
|
|
||||||
|
subparser = subparsers.add_parser(
|
||||||
|
'change-join-password', help='Set the password to join the server')
|
||||||
|
subparser.add_argument('join_password', help='New join password')
|
||||||
|
|
||||||
subparsers.required = True
|
subparsers.required = True
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
@ -92,6 +96,14 @@ def subcommand_set_domain(arguments):
|
|||||||
domain_file.write_text(arguments.domain_name)
|
domain_file.write_text(arguments.domain_name)
|
||||||
|
|
||||||
|
|
||||||
|
def subcommand_change_join_password(arguments):
|
||||||
|
"""Change to password that is required to join the server"""
|
||||||
|
aug = load_augeas()
|
||||||
|
aug.set('.anon/serverpassword', arguments.join_password)
|
||||||
|
aug.save()
|
||||||
|
action_utils.service_try_restart('mumble-server')
|
||||||
|
|
||||||
|
|
||||||
def subcommand_change_root_channel_name(arguments):
|
def subcommand_change_root_channel_name(arguments):
|
||||||
"""Change the name of the Root channel."""
|
"""Change the name of the Root channel."""
|
||||||
aug = load_augeas()
|
aug = load_augeas()
|
||||||
|
|||||||
@ -35,6 +35,15 @@ class MumbleForm(forms.Form):
|
|||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
join_password = forms.CharField(
|
||||||
|
max_length=32,
|
||||||
|
label=_('Set a password to join the server'),
|
||||||
|
widget=forms.PasswordInput,
|
||||||
|
help_text=_('Set a password that is required to join the server. '
|
||||||
|
'Leave empty to use the current password.'),
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
root_channel_name = forms.CharField(
|
root_channel_name = forms.CharField(
|
||||||
label=_('Set the name for the root channel'),
|
label=_('Set the name for the root channel'),
|
||||||
min_length=1,
|
min_length=1,
|
||||||
|
|||||||
@ -39,6 +39,12 @@ class MumbleAppView(AppView):
|
|||||||
messages.success(self.request,
|
messages.success(self.request,
|
||||||
_('SuperUser password successfully updated.'))
|
_('SuperUser password successfully updated.'))
|
||||||
|
|
||||||
|
join_password = new_config.get('join_password')
|
||||||
|
if join_password:
|
||||||
|
actions.superuser_run('mumble',
|
||||||
|
['change-join-password', join_password])
|
||||||
|
messages.success(self.request, _('Join password changed'))
|
||||||
|
|
||||||
name = new_config.get('root_channel_name')
|
name = new_config.get('root_channel_name')
|
||||||
if name:
|
if name:
|
||||||
actions.superuser_run('mumble', ['change-root-channel-name', name])
|
actions.superuser_run('mumble', ['change-root-channel-name', name])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user