From ca43940c1f01707773a925a608e5b538a98a1b29 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sun, 30 Sep 2007 07:52:48 +0000 Subject: [PATCH] sha1 hash password for tray lock --- deluge/ui/gtkui/preferences.py | 10 ++++------ deluge/ui/gtkui/systemtray.py | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 38f18db7e..824709bbd 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -162,9 +162,6 @@ class Preferences: self.gtkui_config["start_in_tray"]) self.glade.get_widget("chk_lock_tray").set_active( self.gtkui_config["lock_tray"]) - self.glade.get_widget("txt_tray_password").set_text( - self.gtkui_config["tray_password"]) - self.glade.get_widget("combo_file_manager").set_active( self.gtkui_config["stock_file_manager"]) self.glade.get_widget("txt_open_folder_location").set_text( @@ -185,6 +182,7 @@ class Preferences: def set_config(self): """Sets all altered config values in the core""" + import sha # Get the values from the dialog new_core_config = {} new_gtkui_config = {} @@ -251,9 +249,9 @@ class Preferences: self.glade.get_widget("chk_start_in_tray").get_active() new_gtkui_config["lock_tray"] = \ self.glade.get_widget("chk_lock_tray").get_active() - new_gtkui_config["tray_password"] = \ - self.glade.get_widget("txt_tray_password").get_text() - + password = sha.new(self.glade.get_widget("txt_tray_password").\ + get_text()).hexdigest() + new_gtkui_config["tray_password"] = password new_gtkui_config["stock_file_manager"] = \ self.glade.get_widget("combo_file_manager").get_active() new_gtkui_config["open_folder_location"] = \ diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py index 037019852..4e78b3df1 100644 --- a/deluge/ui/gtkui/systemtray.py +++ b/deluge/ui/gtkui/systemtray.py @@ -302,6 +302,7 @@ class SystemTray: self.window.update() def unlock_tray(self, comingnext, is_showing_dlg=[False]): + import sha log.debug("Show tray lock dialog") if is_showing_dlg[0]: return @@ -326,7 +327,8 @@ window, please enter your password")) tray_lock.vbox.pack_start(entered_pass) tray_lock.show_all() if tray_lock.run() == gtk.RESPONSE_ACCEPT: - if self.config["tray_password"] == entered_pass.get_text(): + if self.config["tray_password"] == sha.new(entered_pass.get_text())\ + .hexdigest(): if comingnext == "mainwinshow": log.debug("Showing main window via tray") self.window.show()