Skip to content

Instantly share code, notes, and snippets.

@iurisilvio
Last active December 14, 2015 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iurisilvio/5072022 to your computer and use it in GitHub Desktop.
Save iurisilvio/5072022 to your computer and use it in GitHub Desktop.
www.freedomsponsors.org emailmgr diff
diff --git a/django-emailmgr/emailmgr/urls.py b/www.freedomsponsors.org/djangoproject/emailmgr/urls.py
index 31f7a00..eada324 100644
--- a/django-emailmgr/emailmgr/urls.py
+++ b/www.freedomsponsors.org/djangoproject/emailmgr/urls.py
@@ -6,34 +6,34 @@ from views import email_add, email_list, email_delete, \
#add an email to a User account
urlpatterns = patterns('',
- url(
- r'^email/add/$',
- email_add,
- name='emailmgr_email_add'
- ),
- url(
- r'^email/send_activation/(?P<identifier>\w+)/$',
- email_send_activation,
- name='emailmgr_email_send_activation'
- ),
+ # url(
+ # r'^email/add/$',
+ # email_add,
+ # name='emailmgr_email_add'
+ # ),
+ # url(
+ # r'^email/send_activation/(?P<identifier>\w+)/$',
+ # email_send_activation,
+ # name='emailmgr_email_send_activation'
+ # ),
url(
r'^email/activate/(?P<identifier>\w+)/$',
email_activate,
name='emailmgr_email_activate'
),
- url(
- r'^email/make_primary/(?P<identifier>\w+)/$',
- email_make_primary,
- name='emailmgr_email_make_primary'
- ),
- url(
- r'^email/delete/(?P<identifier>\w+)/$',
- email_delete,
- name='emailmgr_email_delete'
- ),
- url(
- r'^email/$',
- email_list,
- name='emailmgr_email_list'
- ),
+ # url(
+ # r'^email/make_primary/(?P<identifier>\w+)/$',
+ # email_make_primary,
+ # name='emailmgr_email_make_primary'
+ # ),
+ # url(
+ # r'^email/delete/(?P<identifier>\w+)/$',
+ # email_delete,
+ # name='emailmgr_email_delete'
+ # ),
+ # url(
+ # r'^email/$',
+ # email_list,
+ # name='emailmgr_email_list'
+ # ),
)
\ No newline at end of file
diff --git a/django-emailmgr/emailmgr/utils.py b/www.freedomsponsors.org/djangoproject/emailmgr/utils.py
index 51a2c6a..fa65e2a 100644
--- a/django-emailmgr/emailmgr/utils.py
+++ b/www.freedomsponsors.org/djangoproject/emailmgr/utils.py
@@ -8,12 +8,9 @@ from django.contrib.auth.models import User
from django.utils.hashcompat import sha_constructor
from django.utils.translation import gettext_lazy as _
import defaults
+from django.core.mail import send_mail
# some people might like to user mailer by jtauber, accomodate them
-if "mailer" in settings.INSTALLED_APPS:
- from mailer import send_mail
-else:
- from django.core.mail import send_mail
# get a random string of known length
def get_unique_random(length=10):
diff --git a/django-emailmgr/emailmgr/views.py b/www.freedomsponsors.org/djangoproject/emailmgr/views.py
index bfdad95..d691f2b 100644
--- a/django-emailmgr/emailmgr/views.py
+++ b/www.freedomsponsors.org/djangoproject/emailmgr/views.py
@@ -109,8 +109,13 @@ def email_activate(request, identifier="somekey"):
email.save()
user_activated_email.send(sender=EmailAddress, email_address=email)
Msg.add_message (request, Msg.SUCCESS, _('email address is now active'))
+ _notify_email_activation(email)
- return HttpResponseRedirect(reverse('emailmgr_email_list'))
+ # return HttpResponseRedirect(reverse('emailmgr_email_list'))
+ return HttpResponseRedirect(email.user.get_view_link()+'?email_verified=true')
+
+def _notify_email_activation(email):
+ email.user.set_email_verified(email.is_primary)
@login_required
def email_delete(request, identifier="somekey"):
commit b9a37f2141008974739d0f96ed087ad32e97377d
Author: tony.franca <tonylampada@gmail.com>
Date: Tue Dec 18 00:46:48 2012 -0200
Decoupling from django-mailer
commit 45c3222ded06033aff09570f8d29a8875aca0cd4
Author: tony.franca <tony.franca@touchtec.com.br>
Date: Sun Aug 12 01:10:04 2012 -0300
bugfix: emailmgr must notify about activation
commit 34a1630d4ab75d5f224f940484598ad7fe68943a
Author: tony.franca <tony.franca@touchtec.com.br>
Date: Sat Aug 11 23:57:40 2012 -0300
#8 Enable other login providers and add email verification. This is still very unstable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment