From 7b304e26c7a09676b40c001188c02ef552191c14 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 10 Jan 2013 12:04:44 +0100 Subject: You can now change your password form the /management page. --- source/auth.py | 4 +++- source/pyAggr3g470r.py | 17 ++++++++++++++++- source/templates/management.html | 9 +++++++++ source/var/password | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/auth.py b/source/auth.py index 3a30eefe..bfaf1b19 100755 --- a/source/auth.py +++ b/source/auth.py @@ -63,7 +63,9 @@ def change_password(username, new_password, password_file='./var/password'): cw = csv.writer(csv_file_write, 'excel_french') for user in users_list: if user[0] == username: - cw.writerow([user[0], new_password]) + m = hashlib.sha1() + m.update(new_password.encode()) + cw.writerow([user[0], m.hexdigest()]) result = True else: cw.writerow(user) diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index b54e8a48..fd6f024b 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -54,7 +54,7 @@ import utils import export import mongodb import feedgetter -from auth import AuthController, require, member_of, name_is +from auth import AuthController, require, member_of, name_is, change_password #from qrcode.pyqrnative.PyQRNative import QRCode, QRErrorCorrectLevel, CodeOverflowException #from qrcode import qr @@ -517,6 +517,21 @@ class pyAggr3g470r(object): change_feed_logo.exposed = True + @require() + def change_password(self, new_password): + """ + Enables to change the name of a feed. + """ + result = change_password(self.auth.username, new_password) + if result: + message = "

Your password has been changed.

" + else: + message = "

Impossible to change the password.

" + tmpl = lookup.get_template("confirmation.html") + return tmpl.render(message=message) + + change_password.exposed = True + @require() def delete_article(self, param): """ diff --git a/source/templates/management.html b/source/templates/management.html index 5bc38439..1f159ede 100644 --- a/source/templates/management.html +++ b/source/templates/management.html @@ -20,6 +20,7 @@
+

Facts