aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-07 10:42:41 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-07 10:42:41 +0200
commit36f15313ca32dc57dc60ed337e55ba3f4f230dd0 (patch)
tree2ef10af3e74b8b6538fe6c176d4db16e4b890cfc /src/web
parentBug fix. (diff)
downloadnewspipe-36f15313ca32dc57dc60ed337e55ba3f4f230dd0.tar.gz
newspipe-36f15313ca32dc57dc60ed337e55ba3f4f230dd0.tar.bz2
newspipe-36f15313ca32dc57dc60ed337e55ba3f4f230dd0.zip
Send an email for the account confirmation.
Diffstat (limited to 'src/web')
-rw-r--r--src/web/models/user.py2
-rw-r--r--src/web/views/session_mgmt.py14
2 files changed, 14 insertions, 2 deletions
diff --git a/src/web/models/user.py b/src/web/models/user.py
index 133901a5..4174cb0f 100644
--- a/src/web/models/user.py
+++ b/src/web/models/user.py
@@ -52,7 +52,7 @@ class User(db.Model, UserMixin, RightMixin):
refresh_rate = db.Column(db.Integer, default=60) # in minutes
# user rights
- is_active = db.Column(db.Boolean(), default=True)
+ is_active = db.Column(db.Boolean(), default=False)
is_admin = db.Column(db.Boolean(), default=False)
is_api = db.Column(db.Boolean(), default=False)
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)
bgstack15