aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-13 19:09:10 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-13 19:09:10 +0200
commit559f14ed074a6d3f52f1acf62c4c74b0ff0c257e (patch)
tree189ed58a259f4c65dd5d13e98daf058dbff9e1d1 /pyaggr3g470r/views.py
parentUpdated translations. (diff)
downloadnewspipe-559f14ed074a6d3f52f1acf62c4c74b0ff0c257e.tar.gz
newspipe-559f14ed074a6d3f52f1acf62c4c74b0ff0c257e.tar.bz2
newspipe-559f14ed074a6d3f52f1acf62c4c74b0ff0c257e.zip
Integration of mailgun.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 2efa5bf2..db5cd64b 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -184,8 +184,14 @@ def signup():
flash(gettext('Email already used.'), 'warning')
return render_template('signup.html', form=form)
- flash(gettext('Your account has been created. You can now sign in.'), 'success')
- return redirect(url_for('home'))
+ # Send the confirmation email
+ result = emails.new_account_notification(user)
+
+ if result.status_code != 200:
+ flash(gettext('Problem while sending activation email.'), 'danger')
+ else:
+ flash(gettext('Your account has been created. Check your mail to confirm it.'), 'success')
+ return redirect(url_for('home'))
return render_template('signup.html', form=form)
@@ -656,6 +662,20 @@ def delete_account():
flash(gettext('This user does not exist.'), 'danger')
return redirect(url_for('login'))
+@app.route('/confirm_account/<string:activation_key>', methods=['GET'])
+def confirm_account(activation_key=None):
+ """
+ Confirm the account of a user.
+ """
+ if activation_key != "":
+ user = User.query.filter(User.activation_key == activation_key).first()
+ if user is not None:
+ user.activation_key = ""
+ db.session.commit()
+ flash(gettext('Your account has been confirmed.'), 'success')
+ else:
+ flash(gettext('Impossible to confirm this account.'), 'danger')
+ return redirect(url_for('login'))
#
# Views dedicated to administration tasks.
bgstack15