VC/Zoom: password -> passcode, make it editable

This commit is contained in:
Pedro Ferreira 2020-11-13 15:34:11 +01:00
parent efc71c9fbf
commit d208f622de
5 changed files with 20 additions and 13 deletions

View File

@ -8,7 +8,7 @@
from __future__ import unicode_literals
from flask import session
from wtforms.fields.core import BooleanField
from wtforms.fields.core import BooleanField, StringField
from wtforms.fields.simple import TextAreaField
from wtforms.validators import DataRequired, ValidationError
@ -16,15 +16,15 @@ from indico.modules.vc.forms import VCRoomAttachFormBase, VCRoomFormBase
from indico.util.user import principal_from_identifier
from indico.web.forms.base import generated_data
from indico.web.forms.fields import IndicoRadioField, PrincipalField
from indico.web.forms.validators import HiddenUnless
from indico.web.forms.validators import HiddenUnless, IndicoRegexp
from indico.web.forms.widgets import SwitchWidget
from indico_vc_zoom import _
class VCRoomAttachForm(VCRoomAttachFormBase):
password_visibility = IndicoRadioField(_("Password visibility"),
description=_("Who should be able to know this meeting's password"),
password_visibility = IndicoRadioField(_("Passcode visibility"),
description=_("Who should be able to know this meeting's passcode"),
orientation='horizontal',
choices=[
('everyone', _('Everyone')),
@ -52,8 +52,12 @@ class VCRoomForm(VCRoomFormBase):
host_user = PrincipalField(_("User"),
[HiddenUnless('host_choice', 'someone_else'), DataRequired()])
password_visibility = IndicoRadioField(_("Password visibility"),
description=_("Who should be able to know this meeting's password"),
password = StringField(_("Passcode"),
[DataRequired(), IndicoRegexp(r'^\d{8,}$')],
description=_("Meeting passcode (min. 8 digits)"))
password_visibility = IndicoRadioField(_("Passcode visibility"),
description=_("Who should be able to know this meeting's passcode"),
orientation='horizontal',
choices=[
('everyone', _('Everyone')),

View File

@ -149,7 +149,8 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
# webinar hosts cannot be changed through the API
form.host_choice.render_kw = {'disabled': True}
form.host_user.render_kw = {'disabled': True}
else:
form.password.data = gen_random_password()
return form
def _extend_indico_cli(self, sender, **kwargs):
@ -185,7 +186,7 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
def update_data_vc_room(self, vc_room, data, is_new=False):
super(ZoomPlugin, self).update_data_vc_room(vc_room, data)
fields = {'description'}
fields = {'description', 'password'}
if data['meeting_type'] == 'webinar':
fields |= {'mute_host_video'}
if is_new:
@ -265,7 +266,7 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
kwargs.update({
'topic': vc_room.name,
'agenda': vc_room.data['description'],
'password': gen_random_password(),
'password': vc_room.data['password'],
'timezone': event.timezone,
'settings': settings
})
@ -283,7 +284,6 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
'url': meeting_obj['join_url'],
'public_url': meeting_obj['join_url'].split('?')[0],
'start_url': meeting_obj['start_url'],
'password': meeting_obj['password'],
'host': host.identifier
})
@ -325,6 +325,9 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
if vc_room.data['description'] != zoom_meeting['agenda']:
changes['agenda'] = vc_room.data['description']
if vc_room.data['password'] != zoom_meeting['password']:
changes['password'] = vc_room.data['password']
zoom_meeting_settings = zoom_meeting['settings']
if vc_room.data['mute_host_video'] == zoom_meeting_settings['host_video']:
changes.setdefault('settings', {})['host_video'] = not vc_room.data['mute_host_video']

View File

@ -7,7 +7,7 @@
</a>
{% elif event_vc_room.data.password_visibility == 'no_one' %}
<a class="i-button icon-lock-center warning {{ extra_classes }}"
title="{% trans %}You will need a password to join this Zoom meeting{% endtrans %}"
title="{% trans %}You will need a passcode to join this Zoom meeting{% endtrans %}"
href="{{ vc_room.data.public_url }}">
{% trans %}Join{% endtrans %}
</a>

View File

@ -12,7 +12,7 @@
{% endif %}
{% if event_vc_room.data.password_visibility == 'everyone' or is_manager or
(session.user and event_vc_room.data.password_visibility == 'logged_in') %}
<dt>{% trans %}Password{% endtrans %}</dt>
<dt>{% trans %}Passcode{% endtrans %}</dt>
<dd>{{ vc_room.data.password }}</dd>
{% endif %}
{% if event_vc_room.data.show_autojoin %}

View File

@ -24,7 +24,7 @@
{% trans %}Session{% endtrans %}: {{ obj.full_title }}
{% endif %}
</dd>
<dt>{% trans %}Password{% endtrans %}</dt>
<dt>{% trans %}Passcode{% endtrans %}</dt>
<dd>{{ vc_room.data.password }}</dd>
<dt>{% trans %}Zoom URL{% endtrans %}</dt>
<dd>