aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-01-10 12:04:44 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-01-10 12:04:44 +0100
commit7b304e26c7a09676b40c001188c02ef552191c14 (patch)
tree467b3861956a7d0345495fc47464ba729caf99db /source
parentAdded default argument for check_credentials(). (diff)
downloadnewspipe-7b304e26c7a09676b40c001188c02ef552191c14.tar.gz
newspipe-7b304e26c7a09676b40c001188c02ef552191c14.tar.bz2
newspipe-7b304e26c7a09676b40c001188c02ef552191c14.zip
You can now change your password form the /management page.
Diffstat (limited to 'source')
-rwxr-xr-xsource/auth.py4
-rwxr-xr-xsource/pyAggr3g470r.py17
-rw-r--r--source/templates/management.html9
-rwxr-xr-xsource/var/password2
4 files changed, 29 insertions, 3 deletions
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
@@ -518,6 +518,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 = "<p>Your password has been changed.</p>"
+ else:
+ message = "<p>Impossible to change the password.</p>"
+ tmpl = lookup.get_template("confirmation.html")
+ return tmpl.render(message=message)
+
+ change_password.exposed = True
+
+ @require()
def delete_article(self, param):
"""
Delete an article.
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 @@
<hr />
+
<h1>Facts</h1>
<ul>
<li>active e-mail notifications: <a href="/notifications/">${nb_mail_notifications}</a>;</li>
@@ -31,6 +32,14 @@
<hr />
+ <h1>Account</h1>
+ <form method=get action="/change_password/">
+ Change your password: <input type="text" name="new_password" value="" />
+ </form>
+
+ <hr />
+
+
<h1>Database</h1>
<p>${nb_articles} article(s) are stored in the database with <a href="/unread/">${nb_unread_articles} unread article(s)</a>.
diff --git a/source/var/password b/source/var/password
index be51ecd2..a1086000 100755
--- a/source/var/password
+++ b/source/var/password
@@ -1 +1 @@
-admin;d033e22ae348aeb5660fc2140aec35850c4da997
+admin;d033e22ae348aeb5660fc2140aec35850c4da997 \ No newline at end of file
bgstack15