codeforlife-portal 8.2.0__py2.py3-none-any.whl → 8.2.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of codeforlife-portal might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codeforlife-portal
3
- Version: 8.2.0
3
+ Version: 8.2.1
4
4
  Classifier: Programming Language :: Python
5
5
  Classifier: Programming Language :: Python :: 3.12
6
6
  Classifier: Framework :: Django
@@ -111,7 +111,7 @@ example_project/portal_test_settings.py,sha256=mTyObCGkZEI0IQSZkqCjb1WZ7ebjQLwui
111
111
  example_project/settings.py,sha256=pHQDI_A_yXV3u1efj689tc-vPI6nBFma4gMMPBzj0aI,5652
112
112
  example_project/urls.py,sha256=FUTzHPlUS1O5kqMHjL5V4L552N2ln7uTDXcw9wjKUto,422
113
113
  example_project/wsgi.py,sha256=U1W6WzZxZaIdYZ5tks7w9fqp5WS5qvn2iThsVcskrWw,829
114
- portal/__init__.py,sha256=Xb24P8T6pG5QQaEw-UTO0iybyDoxvRGJaUR_qFoVAJQ,22
114
+ portal/__init__.py,sha256=lPYx_JLWGM0F2xAcHXVLkIwicje2ZtdqEBMpuaNCsEU,22
115
115
  portal/admin.py,sha256=RKJizTF6dPJKmGPZw7nZUM0X8jkiTjgyKhLQxtvHJ0I,6148
116
116
  portal/app_settings.py,sha256=DhWLQOwM0zVOXE3O5TNKbMM9K6agfLuCsHOdr1J7xEI,651
117
117
  portal/backends.py,sha256=2Dss6_WoQwPuDzJUF1yEaTQTNG4eUrD12ujJQ5cp5Tc,812
@@ -129,7 +129,7 @@ portal/forms/invite_teacher.py,sha256=jkDNcCfkts4_lXRzhcI3xBam21Zn2yX9wMpMVhDtW1
129
129
  portal/forms/organisation.py,sha256=QcQyd7AiqBmvt4y8uQSQylguUbKOKqo2pjqWIkpWjDg,7433
130
130
  portal/forms/play.py,sha256=j_QYAKb4qyW0uy0VUUG49dmzDLINc3jR6ddK-djrbc4,11523
131
131
  portal/forms/registration.py,sha256=a-TuzikRc0Q-BAYs3rJ3Sz1wmQ1o_rTEtZmWdF7-xss,6008
132
- portal/forms/teach.py,sha256=wVwHP2odgMmEGGbbPQzak_1tqutcr1GWZcadvC1Bffg,21739
132
+ portal/forms/teach.py,sha256=c0t9XLfQJFd8hDWbnMUGX15Nt_XDXFG2BfwAKizE-Uw,22381
133
133
  portal/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
134
  portal/helpers/captcha.py,sha256=Amwg3HZ9eIh1LGYVYWYruk1ccNj6P3nYP_evufOY8BY,254
135
135
  portal/helpers/decorators.py,sha256=Bs6AVCvcgxfHLdJVWzTmZpxlYbJZXJh5e9AGRXf7cwo,3617
@@ -492,7 +492,7 @@ portal/templates/portal/tag_manager/tag_manager_body.html,sha256=M_c9T2cfmVm6_Gj
492
492
  portal/templates/portal/tag_manager/tag_manager_head.html,sha256=kWQ4ccJ062cWRJOcfTNaWYTxCmzDsB9JD5v_YdyO5Ic,1288
493
493
  portal/templates/portal/teach/base_registering.html,sha256=jpANyRQbsmWO404l9Mez91zolNP9ic1khWi27WW0FMQ,582
494
494
  portal/templates/portal/teach/class.html,sha256=zir7a7y4hbg9E6-zFIC0iv8kccIzF-qkni4DXlvkjgM,6726
495
- portal/templates/portal/teach/dashboard.html,sha256=SwNdLbTDPaz0O7wVlSVkU8KwIWPzBYsOo6ysOxkOwOc,32674
495
+ portal/templates/portal/teach/dashboard.html,sha256=DcY6rcUjAT9h6VbSIA3mq4fyCIATIlWYDH2qMU1LySg,32697
496
496
  portal/templates/portal/teach/invited.html,sha256=lTsydONG5se1E099KaRgsxGuG12qVHxFUL2X0E3HBmQ,4188
497
497
  portal/templates/portal/teach/onboarding_classes.html,sha256=K212dunXG7eByyCg5lhv4ne-SniMz3kcKXrfianIY6g,2872
498
498
  portal/templates/portal/teach/onboarding_print.html,sha256=4vD2ZDNRxERNdCNj3ZNXJWYAFBQPn9C7Pzsz5TZjZHw,8862
@@ -537,7 +537,7 @@ portal/tests/test_2FA.py,sha256=0N4C9Ab3TvO9W__oQLCo-fLDH1Ho3CiGGsSg-2TiZUE,3597
537
537
  portal/tests/test_admin.py,sha256=AM2dgv8j9m4L-SDO-sMA9tQvQH9GwRBrlwRG9OgqtfI,1451
538
538
  portal/tests/test_api.py,sha256=Yo5s_nEGOoG35jA39yZ6nuDOUZvuCZ8o8o8XhZos61w,13819
539
539
  portal/tests/test_captcha_forms.py,sha256=Yn_VYO_6jbq6AeKeLcv-YFL1YwXZpU0C3y7SK8fRUm4,1033
540
- portal/tests/test_class.py,sha256=MfR8fRsi0XjqS5cbeV19y3Be2RVhOLUHsAy_mjm7P70,17644
540
+ portal/tests/test_class.py,sha256=_P2CEtqH67MM9h6MMQB_PxXFyQj4tZZbN42NJQpIJ7o,18308
541
541
  portal/tests/test_emails.py,sha256=pLr06j3uMBxP1raoZQWzUTBVFvsEDFtUh85J8OnqCwE,9238
542
542
  portal/tests/test_global_forms.py,sha256=GIm_oSN4VsfaO--E2SMRu8CwVraan0UBj-_LE_tu8w0,833
543
543
  portal/tests/test_helper_methods.py,sha256=-SQCDZm2XUtyXGEp0CHIb_SSC9CPD-XOSnpnY8QclHk,890
@@ -634,8 +634,8 @@ portal/views/two_factor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
634
634
  portal/views/two_factor/core.py,sha256=Lk32z2SN2Pg0rRkK-N-LXMvXC1kKKsH3l692kiSDQ4E,964
635
635
  portal/views/two_factor/form.py,sha256=lnHNKI-BMlpncTuW3zUzjPaJJNuEra2I_nOam0eOKFY,257
636
636
  portal/views/two_factor/profile.py,sha256=SHSg_xHccE5PtD-OfuOkYhREYz_er4bj5ro1RjJ88Yw,393
637
- codeforlife_portal-8.2.0.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
638
- codeforlife_portal-8.2.0.dist-info/METADATA,sha256=ZSsWDJV-GTrgYnPCZ2sb5Q2_y3c2c_RaLoTN3QZudd4,3077
639
- codeforlife_portal-8.2.0.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
640
- codeforlife_portal-8.2.0.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
641
- codeforlife_portal-8.2.0.dist-info/RECORD,,
637
+ codeforlife_portal-8.2.1.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
638
+ codeforlife_portal-8.2.1.dist-info/METADATA,sha256=x6DvD4-jLnlOAwIbP6k0mLhRatr4zoTaZMtTpmsCZOQ,3077
639
+ codeforlife_portal-8.2.1.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
640
+ codeforlife_portal-8.2.1.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
641
+ codeforlife_portal-8.2.1.dist-info/RECORD,,
portal/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.2.0"
1
+ __version__ = "8.2.1"
portal/forms/teach.py CHANGED
@@ -234,6 +234,16 @@ class ClassCreationForm(forms.Form):
234
234
 
235
235
  self.fields["teacher"].choices = teacher_choices
236
236
 
237
+ def clean(self):
238
+ name = self.cleaned_data.get("class_name", "")
239
+
240
+ if re.match(re.compile("^[\w -]+$"), name) is None:
241
+ raise forms.ValidationError(
242
+ "Class name may only contain letters, numbers, dashes, underscores, and spaces."
243
+ )
244
+
245
+ return self.cleaned_data
246
+
237
247
 
238
248
  class ClassEditForm(forms.Form):
239
249
  # select dropdown choices for potentially limiting time in which external students may join
@@ -288,6 +298,16 @@ class ClassEditForm(forms.Form):
288
298
  widget=forms.Select(),
289
299
  )
290
300
 
301
+ def clean(self):
302
+ name = self.cleaned_data.get("name", "")
303
+
304
+ if re.match(re.compile("^[\w -]+$"), name) is None:
305
+ raise forms.ValidationError(
306
+ "Class name may only contain letters, numbers, dashes, underscores, and spaces."
307
+ )
308
+
309
+ return self.cleaned_data
310
+
291
311
 
292
312
  class ClassLevelControlForm(forms.Form):
293
313
  def __init__(self, *args, **kwargs):
@@ -364,7 +364,7 @@
364
364
  </p>
365
365
  {% endif %}
366
366
 
367
- <form autocomplete="off" method="post">
367
+ <form id="form-create-class" autocomplete="off" method="post">
368
368
 
369
369
  {% csrf_token %}
370
370
 
@@ -15,6 +15,7 @@ from django.urls import reverse
15
15
  from game.models import Level
16
16
 
17
17
  from .base_test import BaseTest
18
+ from .pageObjects.portal.home_page import HomePage
18
19
  from .pageObjects.portal.teach.class_page import TeachClassPage
19
20
  from .utils.classes import create_class
20
21
  from .utils.messages import is_class_created_message_showing
@@ -537,3 +538,23 @@ class TestClassFrontend(BaseTest):
537
538
  page, class_name_3 = create_class(page)
538
539
 
539
540
  assert is_class_created_message_showing(self.selenium, class_name_3)
541
+
542
+ def test_create_invalid_name(self):
543
+ email, password = signup_teacher_directly()
544
+ create_organisation_directly(email)
545
+
546
+ class_name = "Class!"
547
+
548
+ self.selenium.get(self.live_server_url)
549
+ page = (
550
+ HomePage(self.selenium)
551
+ .go_to_teacher_login_page()
552
+ .login_no_class(email, password)
553
+ .open_classes_tab()
554
+ )
555
+
556
+ page = page.create_class(class_name, False)
557
+
558
+ assert page.was_form_invalid(
559
+ "form-create-class", "Class name may only contain letters, numbers, dashes, underscores, and spaces."
560
+ )