Last active
December 14, 2015 10:18
-
-
Save iurisilvio/5070686 to your computer and use it in GitHub Desktop.
www.freedomsponsors.org django-registration diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/djangoproject/registration/auth_urls.py b/djangoproject/registration/auth_urls.py | |
index 9bb1bc3..da93a3f 100644 | |
--- a/djangoproject/registration/auth_urls.py | |
+++ b/djangoproject/registration/auth_urls.py | |
@@ -27,6 +27,13 @@ from django.conf.urls.defaults import * | |
from django.contrib.auth import views as auth_views | |
+# from registration.forms import MailerPasswordResetForm | |
+from django.conf import settings | |
+ | |
+ | |
+custom_password_reset = lambda request: auth_views.password_reset(request, | |
+ # password_reset_form=MailerPasswordResetForm, | |
+ extra_context={'SITE_HOME':settings.SITE_HOME}) | |
urlpatterns = patterns('', | |
url(r'^login/$', | |
@@ -45,6 +52,7 @@ urlpatterns = patterns('', | |
name='auth_password_change_done'), | |
url(r'^password/reset/$', | |
auth_views.password_reset, | |
+ # custom_password_reset, | |
name='auth_password_reset'), | |
url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', | |
auth_views.password_reset_confirm, | |
diff --git a/djangoproject/registration/forms.py b/djangoproject/registration/forms.py | |
index 8382a88..3e1b940 100644 | |
--- a/djangoproject/registration/forms.py | |
+++ b/djangoproject/registration/forms.py | |
@@ -54,6 +54,30 @@ class RegistrationForm(forms.Form): | |
else: | |
return self.cleaned_data['username'] | |
+ def clean_email(self): | |
+ """ | |
+ Validate that the email is not already | |
+ in use. | |
+ | |
+ """ | |
+ existing = User.objects.filter(email__iexact=self.cleaned_data['email']) | |
+ if existing.exists(): | |
+ raise forms.ValidationError(_("A user with that email already exists.")) | |
+ else: | |
+ return self.cleaned_data['email'] | |
+ | |
+ def clean_password1(self): | |
+ """ | |
+ Validate that the email is not already | |
+ in use. | |
+ | |
+ """ | |
+ password = self.cleaned_data['password1'] | |
+ if len(password) < 6: | |
+ raise forms.ValidationError(_("We won't lecture you on password security - you probably heard enough about it by now. But please make it at least 6 characters long!")) | |
+ else: | |
+ return self.cleaned_data['password1'] | |
+ | |
def clean(self): | |
""" | |
Verifiy that the values entered into the two password fields | |
@@ -121,3 +145,4 @@ class RegistrationFormNoFreeEmail(RegistrationForm): | |
if email_domain in self.bad_domains: | |
raise forms.ValidationError(_("Registration using free email addresses is prohibited. Please supply a different email address.")) | |
return self.cleaned_data['email'] | |
+ | |
diff --git a/djangoproject/registration/models.py b/djangoproject/registration/models.py | |
index 16023b8..3252760 100644 | |
--- a/djangoproject/registration/models.py | |
+++ b/djangoproject/registration/models.py | |
@@ -9,6 +9,7 @@ from django.db import models | |
from django.db import transaction | |
from django.template.loader import render_to_string | |
from django.utils.translation import ugettext_lazy as _ | |
+from django.core.mail import send_mail | |
try: | |
from django.utils.timezone import now as datetime_now | |
@@ -252,7 +253,7 @@ class RegistrationProfile(models.Model): | |
""" | |
ctx_dict = {'activation_key': self.activation_key, | |
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, | |
- 'site': site} | |
+ 'SITE_HOME': settings.SITE_HOME} | |
subject = render_to_string('registration/activation_email_subject.txt', | |
ctx_dict) | |
# Email subject *must not* contain newlines | |
@@ -261,5 +262,6 @@ class RegistrationProfile(models.Model): | |
message = render_to_string('registration/activation_email.txt', | |
ctx_dict) | |
- self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL) | |
+ send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [self.user.email]) | |
+ # self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit b9a37f2141008974739d0f96ed087ad32e97377d | |
Author: tony.franca <tonylampada@gmail.com> | |
Date: Tue Dec 18 00:46:48 2012 -0200 | |
Decoupling from django-mailer | |
commit 88334ec59524d1bd12e2d0844fd83d16729b45a8 | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Thu Sep 27 18:27:09 2012 -0300 | |
Removing unused code | |
commit 644a2764faa2fd96dd90831c8afe8293f1422a28 | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Wed Sep 26 18:22:57 2012 -0300 | |
Adjustments to plain user registration | |
commit da160537c92c4c0e970eba5e8010f3a700d5ff61 | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Tue Sep 25 10:35:14 2012 -0300 | |
still trying to get travis green | |
commit 5dc5715e24efd4f65c34d758956c48a3db69f109 | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Tue Sep 25 02:06:21 2012 -0300 | |
Adjustments to login/password registration | |
commit 22272601346da24ba7733aa471557ffce3a4d762 | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Mon Sep 24 17:52:42 2012 -0300 | |
bugfix | |
commit 9310600c827268875b2f4563a0984c2d6eea4851 | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Mon Sep 24 17:50:46 2012 -0300 | |
trying to make django-registration work with django-mailer | |
commit 300c2d005a74c52bc578513bc3a71d7922d15fdd | |
Author: tonylampada <tonylampada@gmail.com> | |
Date: Mon Sep 24 17:27:32 2012 -0300 | |
#32 Adding django-registration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment