Fixed an issue related to the query tool update connection after the server disconnected from the object explorer. #7865

This commit is contained in:
Anil Sahoo 2024-11-19 15:44:40 +05:30 committed by GitHub
parent a8384a8826
commit 8be65ceb7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View File

@ -1388,7 +1388,7 @@ class ServerNode(PGChildNodeView):
If Yes, connect the server and return connection.
If No, Raise HTTP error and ask for the password.
In case of 'Save Password' request from user, excrypted Password
In case of 'Save Password' request from user, encrypted Password
will be stored in the respected server database and
establish the connection OR just connect the server and do not
store the password.

View File

@ -406,10 +406,11 @@ def _connect(conn, **kwargs):
user = kwargs['user']
role = kwargs['role'] if kwargs['role'] else None
password = kwargs['password'] if kwargs['password'] else None
encpass = kwargs['encpass'] if kwargs['encpass'] else None
is_ask_password = True
if user:
status, msg = conn.connect(user=user, role=role,
password=password)
password=password, encpass=encpass)
else:
status, msg = conn.connect(**kwargs)
@ -424,9 +425,14 @@ def _init_sqleditor(trans_id, connect, sgid, sid, did, dbname=None, **kwargs):
kwargs.pop('conn_id')
conn_id_ac = str(secrets.choice(range(1, 9999999)))
server = Server.query.filter_by(id=sid).first()
manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
if kwargs.get('password', None) is None:
kwargs['encpass'] = server.password
else:
kwargs['encpass'] = None
if did is None:
did = manager.did
try:
@ -459,7 +465,6 @@ def _init_sqleditor(trans_id, connect, sgid, sid, did, dbname=None, **kwargs):
if not status:
current_app.logger.error(msg)
if is_ask_password:
server = Server.query.filter_by(id=sid).first()
return True, make_json_response(
success=0,
status=428,

View File

@ -233,7 +233,10 @@ class Connection(BaseConnection):
kwargs.pop('password')
is_update_password = False
else:
encpass = kwargs['password'] if 'password' in kwargs else None
if 'encpass' in kwargs:
encpass = kwargs['encpass']
else:
encpass = kwargs['password'] if 'password' in kwargs else None
return password, encpass, is_update_password