aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/admin.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-18 08:59:13 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-18 08:59:13 +0100
commit2e5a241777ef0bb0d76420d39bf3be41e16e042a (patch)
tree3223b8fba4fa244fa97b0df0b8bf8c5b91aeffec /src/web/views/admin.py
parentCheck if the id of the category is '0'. (diff)
downloadnewspipe-2e5a241777ef0bb0d76420d39bf3be41e16e042a.tar.gz
newspipe-2e5a241777ef0bb0d76420d39bf3be41e16e042a.tar.bz2
newspipe-2e5a241777ef0bb0d76420d39bf3be41e16e042a.zip
New management of the token for the account confirmation.
Diffstat (limited to 'src/web/views/admin.py')
-rw-r--r--src/web/views/admin.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/web/views/admin.py b/src/web/views/admin.py
index 30758f63..832c134d 100644
--- a/src/web/views/admin.py
+++ b/src/web/views/admin.py
@@ -83,13 +83,13 @@ def process_user_form(user_id=None):
flash(gettext('User %(nick)s successfully updated',
nick=user.nickname), 'success')
else:
- # Create a new user
+ # Create a new user (by the admin)
user = user_contr.create(nickname=form.nickname.data,
email=form.email.data,
password=form.password.data,
roles=[role_user],
refresh_rate=form.refresh_rate.data,
- activation_key="")
+ enabled=True)
flash(gettext('User %(nick)s successfully created',
nick=user.nickname), 'success')
return redirect(url_for('admin.user_form', user_id=user.id))
@@ -144,12 +144,11 @@ def toggle_user(user_id=None):
flash(gettext('This user does not exist.'), 'danger')
return redirect(url_for('admin.dashboard'))
- if user.activation_key != "":
-
+ if not user.enabled:
# Send the confirmation email
try:
notifications.new_account_activation(user)
- user_contr.unset_activation_key(user.id)
+ user_contr.update({'id': user.id}, {'enabled': True})
message = gettext('Account of the user %(nick)s successfully '
'activated.', nick=user.nickname)
except Exception as error:
@@ -158,7 +157,7 @@ def toggle_user(user_id=None):
return redirect(url_for('admin.dashboard'))
else:
- user_contr.set_activation_key(user.id)
+ user_contr.update({'id': user.id}, {'enabled': False})
message = gettext('Account of the user %(nick)s successfully disabled',
nick=user.nickname)
flash(message, 'success')
bgstack15