sha1 hash password for tray lock

This commit is contained in:
Marcos Pinto 2007-09-30 07:52:48 +00:00
parent fd03c62ccb
commit ca43940c1f
2 changed files with 7 additions and 7 deletions

View File

@ -162,9 +162,6 @@ class Preferences:
self.gtkui_config["start_in_tray"]) self.gtkui_config["start_in_tray"])
self.glade.get_widget("chk_lock_tray").set_active( self.glade.get_widget("chk_lock_tray").set_active(
self.gtkui_config["lock_tray"]) 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.glade.get_widget("combo_file_manager").set_active(
self.gtkui_config["stock_file_manager"]) self.gtkui_config["stock_file_manager"])
self.glade.get_widget("txt_open_folder_location").set_text( self.glade.get_widget("txt_open_folder_location").set_text(
@ -185,6 +182,7 @@ class Preferences:
def set_config(self): def set_config(self):
"""Sets all altered config values in the core""" """Sets all altered config values in the core"""
import sha
# Get the values from the dialog # Get the values from the dialog
new_core_config = {} new_core_config = {}
new_gtkui_config = {} new_gtkui_config = {}
@ -251,9 +249,9 @@ class Preferences:
self.glade.get_widget("chk_start_in_tray").get_active() self.glade.get_widget("chk_start_in_tray").get_active()
new_gtkui_config["lock_tray"] = \ new_gtkui_config["lock_tray"] = \
self.glade.get_widget("chk_lock_tray").get_active() self.glade.get_widget("chk_lock_tray").get_active()
new_gtkui_config["tray_password"] = \ password = sha.new(self.glade.get_widget("txt_tray_password").\
self.glade.get_widget("txt_tray_password").get_text() get_text()).hexdigest()
new_gtkui_config["tray_password"] = password
new_gtkui_config["stock_file_manager"] = \ new_gtkui_config["stock_file_manager"] = \
self.glade.get_widget("combo_file_manager").get_active() self.glade.get_widget("combo_file_manager").get_active()
new_gtkui_config["open_folder_location"] = \ new_gtkui_config["open_folder_location"] = \

View File

@ -302,6 +302,7 @@ class SystemTray:
self.window.update() self.window.update()
def unlock_tray(self, comingnext, is_showing_dlg=[False]): def unlock_tray(self, comingnext, is_showing_dlg=[False]):
import sha
log.debug("Show tray lock dialog") log.debug("Show tray lock dialog")
if is_showing_dlg[0]: if is_showing_dlg[0]:
return return
@ -326,7 +327,8 @@ window, please enter your password"))
tray_lock.vbox.pack_start(entered_pass) tray_lock.vbox.pack_start(entered_pass)
tray_lock.show_all() tray_lock.show_all()
if tray_lock.run() == gtk.RESPONSE_ACCEPT: 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": if comingnext == "mainwinshow":
log.debug("Showing main window via tray") log.debug("Showing main window via tray")
self.window.show() self.window.show()