diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-07 10:42:41 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-07 10:42:41 +0200 |
commit | 36f15313ca32dc57dc60ed337e55ba3f4f230dd0 (patch) | |
tree | 2ef10af3e74b8b6538fe6c176d4db16e4b890cfc /src/web/views/session_mgmt.py | |
parent | Bug fix. (diff) | |
download | newspipe-36f15313ca32dc57dc60ed337e55ba3f4f230dd0.tar.gz newspipe-36f15313ca32dc57dc60ed337e55ba3f4f230dd0.tar.bz2 newspipe-36f15313ca32dc57dc60ed337e55ba3f4f230dd0.zip |
Send an email for the account confirmation.
Diffstat (limited to 'src/web/views/session_mgmt.py')
-rw-r--r-- | src/web/views/session_mgmt.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/web/views/session_mgmt.py b/src/web/views/session_mgmt.py index 5e67513a..dc80516a 100644 --- a/src/web/views/session_mgmt.py +++ b/src/web/views/session_mgmt.py @@ -16,6 +16,7 @@ import conf from web.views.common import admin_role, api_role, login_user_bundle from web.controllers import UserController from web.forms import SignupForm, SigninForm +from web import notifications Principal(current_app) # Create a permission with a single Need, in this case a RoleNeed. @@ -88,7 +89,18 @@ def signup(): user = UserController().create(nickname=form.nickname.data, email=form.email.data, pwdhash=generate_password_hash(form.password.data)) - login_user_bundle(user) + + # Send the confirmation email + try: + notifications.new_account_notification(user) + except Exception as error: + flash(gettext('Problem while sending activation email: %(error)s', + error=error), 'danger') + return redirect(url_for('home')) + + 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) |