aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-13 21:33:16 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-13 21:33:16 +0200
commit55dd4537491462454ffa1b3612387260811a07c7 (patch)
tree1056c055ac8d12ef2cb2897adacb5517613b7102
parentDisplay user activation key? (diff)
downloadnewspipe-55dd4537491462454ffa1b3612387260811a07c7.tar.gz
newspipe-55dd4537491462454ffa1b3612387260811a07c7.tar.bz2
newspipe-55dd4537491462454ffa1b3612387260811a07c7.zip
Test with postmark OK.
-rw-r--r--pyaggr3g470r/emails.py31
-rw-r--r--pyaggr3g470r/templates/admin/user.html2
-rw-r--r--pyaggr3g470r/views.py1
3 files changed, 17 insertions, 17 deletions
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 @@
<div class="col-md-6">
<p>{{ _('Member since') }} {{ user.date_created | datetime }}.</p>
<p>{{ _('Last seen:') }} {{ user.last_seen | datetime }}.</p>
- <p>{{ _('Activation key:') }}{{ user.activation_key }}</p>
+ <p>{{ _('Activation key:') }} {{ user.activation_key }}</p>
</div>
<div class="col-md-6">
<img src="{{ user.email | gravatar }}" />
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')
bgstack15