aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-04 19:47:00 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-04 19:47:00 +0200
commit5dee29c0c0faf299824503b0060ef16dd1a43eb8 (patch)
tree5a3c3f79641a7dcd71372493d1e2b9f18258f5e0 /pyaggr3g470r/views.py
parentUpdated translations. (diff)
downloadnewspipe-5dee29c0c0faf299824503b0060ef16dd1a43eb8.tar.gz
newspipe-5dee29c0c0faf299824503b0060ef16dd1a43eb8.tar.bz2
newspipe-5dee29c0c0faf299824503b0060ef16dd1a43eb8.zip
The user has now the possibility to delete it's account.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 4729cd0c..58a3b361 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -616,6 +616,20 @@ def profile():
form = ProfileForm(obj=user)
return render_template('profile.html', user=user, form=form)
+@app.route('/delete_account/', methods=['GET'])
+@login_required
+def delete_account():
+ """
+ Delete the account of the user (with all its data).
+ """
+ user = User.query.filter(User.email == g.user.email).first()
+ if user is not None:
+ db.session.delete(user)
+ db.session.commit()
+ flash(gettext('Your account has been deleted.'), 'success')
+ else:
+ flash(gettext('This user does not exist.'), 'danger')
+ return redirect(url_for('home'))
#
@@ -696,7 +710,7 @@ def user(user_id=None):
@admin_permission.require(http_exception=403)
def delete_user(user_id=None):
"""
- Delete a user (with its stations and measures).
+ Delete a user (with all its data).
"""
user = User.query.filter(User.id == user_id).first()
if user is not None:
bgstack15