From 55dd4537491462454ffa1b3612387260811a07c7 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 13 May 2014 21:33:16 +0200 Subject: Test with postmark OK. --- pyaggr3g470r/emails.py | 31 ++++++++++++++++--------------- pyaggr3g470r/templates/admin/user.html | 2 +- pyaggr3g470r/views.py | 1 - 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/emails.py b/pyaggr3g470r/emails.py index e9d3b418..c4bcb61f 100644 --- a/pyaggr3g470r/emails.py +++ b/pyaggr3g470r/emails.py @@ -59,28 +59,29 @@ def send_email(mfrom, mto, feed, article): else: s.sendmail(mfrom, mto, msg.as_string()) s.quit() - + # # Notifications # def new_account_notification(user): - try: - plaintext = """Hello,\n\nYour account has been created. Click on the following link to confirm it:\n%s""" % \ - (conf.PLATFORM_URL + 'confirm_account/' + user.activation_key) - #plaintext = utils.clear_string(html) - - - message = PMMail(api_key = conf.POSTMARK_API_KEY, - subject = "[pyAggr3g470r] Account activation", - sender = conf.ADMIN_EMAIL, - to = user.email, - text_body = plaintext) + if conf.ON_HEROKU: + try: + plaintext = """Hello,\n\nYour account has been created. Click on the following link to confirm it:\n%s\n\nSee you,""" % \ + (conf.PLATFORM_URL + 'confirm_account/' + user.activation_key) + + message = PMMail(api_key = conf.POSTMARK_API_KEY, + subject = "[pyAggr3g470r] Account activation", + sender = conf.ADMIN_EMAIL, + to = user.email, + text_body = plaintext) - message.send() - except Exception as e: - raise e + message.send() + except Exception as e: + raise e + else: + pass diff --git a/pyaggr3g470r/templates/admin/user.html b/pyaggr3g470r/templates/admin/user.html index fbf7d5f2..d4158795 100644 --- a/pyaggr3g470r/templates/admin/user.html +++ b/pyaggr3g470r/templates/admin/user.html @@ -11,7 +11,7 @@

{{ _('Member since') }} {{ user.date_created | datetime }}.

{{ _('Last seen:') }} {{ user.last_seen | datetime }}.

-

{{ _('Activation key:') }}{{ user.activation_key }}

+

{{ _('Activation key:') }} {{ user.activation_key }}

diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 40b2d0c3..7e73b7da 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -190,7 +190,6 @@ def signup(): emails.new_account_notification(user) except Exception as e: flash(gettext('Problem while sending activation email: '+ str(e)), 'danger') - print str(e) return redirect(url_for('home')) flash(gettext('Your account has been created. Check your mail to confirm it.'), 'success') -- cgit