Fixing the decryption issue during restoring the connection on restart.

As we convert the binary password to string during storing the
connection information, we also need to convert it back to byte-arrays
during restoring the connections.

Hence - decode the passowrd using 'utf-8' encoding during storing the
connection information, and encode it during restoring the connections.
This commit is contained in:
Ashesh Vashi 2016-06-06 22:48:50 +05:30
parent 7f1e57c2a6
commit 37e2e1d24b

View File

@ -1049,7 +1049,7 @@ class ServerManager(object):
res = dict()
res['sid'] = self.sid
res['password'] = str(self.password)
res['password'] = self.password.decode('utf-8')
connections = res['connections'] = dict()
@ -1151,6 +1151,10 @@ WHERE db.oid = {0}""".format(did))
# first connection for identifications.
from pgadmin.browser.server_groups.servers.types import ServerType
self.pinged = datetime.datetime.now()
try:
data['password'] = data['password'].encode('utf-8')
except:
pass
connections = data['connections']
for conn_id in connections: