Fix crash in browser mode with Python 3

The crash occurs while trying to unlock a password protected Glances
server (TypeError: Unicode-objects must be encoded before hashing).
This commit is contained in:
Alessio Sergi 2015-02-24 00:12:24 +01:00
parent ccb1751be0
commit 76cdd091eb

View File

@ -163,7 +163,7 @@ class GlancesClientBrowser(object):
# Display a popup to enter password
clear_password = self.screen.display_popup(_("Password needed for %s: " % v['name']), is_input=True)
# Hash with SHA256
encoded_password = sha256(clear_password).hexdigest()
encoded_password = sha256(clear_password.encode('utf-8')).hexdigest()
# Store the password for the selected server
self.set_in_selected('password', encoded_password)