1) Don't ask for SSH Tunnel or Database server password if it is already saved.
2) Modified the generic error message from SSH Tunnel library.pull/9209/head
parent
999462816b
commit
27f0125c24
|
|
@ -1432,8 +1432,9 @@ class ServerNode(PGChildNodeView):
|
|||
"""
|
||||
prompt_tunnel_password = True
|
||||
# In case of identity file check the value of tunnel_prompt_password.
|
||||
if server.tunnel_identity_file is not None and \
|
||||
server.tunnel_prompt_password != 1:
|
||||
if server.tunnel_password is not None or \
|
||||
(server.tunnel_identity_file is not None and
|
||||
server.tunnel_prompt_password != 1):
|
||||
prompt_tunnel_password = False
|
||||
|
||||
return prompt_tunnel_password
|
||||
|
|
@ -1595,7 +1596,7 @@ class ServerNode(PGChildNodeView):
|
|||
)
|
||||
except Exception as e:
|
||||
return self.get_response_for_password(
|
||||
server, 401, True, prompt_tunnel_password,
|
||||
server, 401, not server.save_password, prompt_tunnel_password,
|
||||
getattr(e, 'message', str(e)))
|
||||
|
||||
if not status:
|
||||
|
|
@ -1607,7 +1608,8 @@ class ServerNode(PGChildNodeView):
|
|||
return internal_server_error(errmsg)
|
||||
|
||||
return self.get_response_for_password(
|
||||
server, 401, True, prompt_tunnel_password, errmsg)
|
||||
server, 401, not server.save_password,
|
||||
prompt_tunnel_password, errmsg)
|
||||
else:
|
||||
if save_password and config.ALLOW_SAVE_PASSWORD:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight,
|
|||
<DefaultButton data-test="close" startIcon={<CloseIcon />} onClick={()=>{
|
||||
closeModal();
|
||||
}} >{gettext('Cancel')}</DefaultButton>
|
||||
{(data.prompt_password || data.prompt_tunnel_password) && <>
|
||||
<PrimaryButton ref={okBtnRef} data-test="save" startIcon={<CheckRoundedIcon />} onClick={()=>{
|
||||
let postFormData = new FormData();
|
||||
if(data.prompt_tunnel_password) {
|
||||
|
|
@ -124,6 +125,7 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight,
|
|||
onOK?.(postFormData);
|
||||
closeModal();
|
||||
}} >{gettext('OK')}</PrimaryButton>
|
||||
</>}
|
||||
</ModalFooter>
|
||||
</ModalContent>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -612,8 +612,12 @@ WHERE db.oid = {0}""".format(did))
|
|||
self.tunnel_created = True
|
||||
except BaseSSHTunnelForwarderError as e:
|
||||
current_app.logger.exception(e)
|
||||
return False, gettext("Failed to create the SSH tunnel.\n"
|
||||
"Error: {0}").format(str(e))
|
||||
return False, gettext(
|
||||
"Failed to create the SSH tunnel. Possible causes:\n"
|
||||
"1. Enter the correct tunnel password (Clear saved password "
|
||||
"if it has changed).\n 2. If using an identity file that "
|
||||
"requires a password, enable “Prompt for Password?” in the "
|
||||
"server dialog. \n 3. Verify the host address.")
|
||||
|
||||
# Update the port to communicate locally
|
||||
self.local_bind_port = self.tunnel_object.local_bind_port
|
||||
|
|
|
|||
Loading…
Reference in New Issue