Self hosted FLOSS fitness/workout, nutrition and weight tracker
Rename submit button
Roland Geider06b19763c66c
diff --git a/wger/core/forms.py b/wger/core/forms.pyindex 7e09a9d6f..2dc786eb6 100644--- a/wger/core/forms.py+++ b/wger/core/forms.py@@ -120,7 +120,11 @@ class WgerSignupForm(AllauthSignupForm):self.helper.form_class = 'wger-form'self.helper.layout = Layout(*layout_fields,- ButtonHolder(Submit('submit', _('Register'), css_class='btn-success btn-block')),+ # The submit button must not be named "submit": a form control named+ # "submit" shadows the native HTMLFormElement.submit() method, which+ # the django-recaptcha v3 widget calls to submit the form after the+ # token is set+ ButtonHolder(Submit('submitBtn', _('Register'), css_class='btn-success btn-block')),)diff --git a/wger/core/tests/test_registration.py b/wger/core/tests/test_registration.pyindex af5959566..7ccc0ad08 100644--- a/wger/core/tests/test_registration.py+++ b/wger/core/tests/test_registration.py@@ -66,6 +66,24 @@ class RegistrationTestCase(WgerTestCase):response = self.client.get(reverse('core:user:registration'))self.assertNotIn('captcha', response.context['form'].fields)+ def test_signup_submit_button_not_named_submit(self):+ """+ The submit button must not be named "submit": a control with that name+ shadows HTMLFormElement.submit(), which the reCAPTCHA v3 widget calls to+ submit the form once the token is set.+ """+ with self.settings(+ WGER_SETTINGS={+ 'USE_RECAPTCHA': True,+ 'ALLOW_REGISTRATION': True,+ 'ALLOW_GUEST_USERS': True,+ 'MASTODON': False,+ 'MIN_ACCOUNT_AGE_TO_TRUST': 21,+ }+ ):+ response = self.client.get(reverse('core:user:registration'))+ self.assertNotContains(response, 'name="submit"')+def test_register(self):# Fetch the registration pageresponse = self.client.get(reverse('core:user:registration'))