sio2project / oioioi

GNU General Public License v3.0
162 stars 72 forks source link

Fix not accounting for disabled activation emails #267

Closed A-dead-pixel closed 9 months ago

A-dead-pixel commented 1 year ago

...in the "Sign-up successful" message.

This is another fixup of the Register -> Sign-up switch. The change in url names resulted in django-registration-redux's view/url not being overriden, so the "Sign-up successful" message would mention activation emails even when sending those was disabled.

MasloMaslane commented 11 months ago

On sio2.mimuw we changed it like this:

diff --git a/oioioi/base/registration_backend.py b/oioioi/base/registration_backend.py
index f38f2286..35d5e4be 100644
--- a/oioioi/base/registration_backend.py
+++ b/oioioi/base/registration_backend.py
@@ -63,7 +63,13 @@ class RegistrationView(DefaultRegistrationView):

 urlpatterns = [
-    re_path(r'^sign-up/$', RegistrationView.as_view(), name='sign-up'),
+    re_path(
+        r'^sign-up/$',
+        RegistrationView.as_view(
+            success_url=reverse_lazy('sign-up_complete')
+        ),
+        name='sign-up',
+    ),
     re_path(
         r'^register/$',
         RedirectView.as_view(pattern_name='sign-up', permanent=True),

I think this solutions is better, as it doesn't require changing sign-up -> register again.

A-dead-pixel commented 11 months ago

What @MasloMaslane suggested seems to be the proper way to do this, though I had to change it a bit for it to work with activation emails enabled.