From 36f15313ca32dc57dc60ed337e55ba3f4f230dd0 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 7 Apr 2016 10:42:41 +0200 Subject: Send an email for the account confirmation. --- src/web/views/session_mgmt.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/web/views/session_mgmt.py') 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) -- cgit