From d90b2621dac60d9ad88ebf198758207acffba08e Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Wed, 22 Jun 2022 17:35:22 +0530 Subject: [PATCH] Fixed an issue where passwords entered in the 'Connect To Server' dialog were truncated. Fixes #7440 --- docs/en_US/release_notes_6_11.rst | 1 + .../databases/subscriptions/static/js/subscription.ui.js | 3 ++- .../browser/server_groups/servers/static/js/server.ui.js | 8 +++++++- web/pgadmin/browser/static/js/ConnectServerContent.jsx | 4 ++-- web/pgadmin/static/js/components/FormComponents.jsx | 5 +++-- .../javascript/components/FormComponents.spec.js | 5 +++-- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/en_US/release_notes_6_11.rst b/docs/en_US/release_notes_6_11.rst index 527e037be..736c53219 100644 --- a/docs/en_US/release_notes_6_11.rst +++ b/docs/en_US/release_notes_6_11.rst @@ -28,6 +28,7 @@ Bug fixes ********* | `Issue #7423 `_ - Fixed an issue where there is no setting to turn off notifications in the Query Tool. + | `Issue #7440 `_ - Fixed an issue where passwords entered in the 'Connect To Server' dialog were truncated. | `Issue #7441 `_ - Ensure that the Query Editor should be focused when switching between query tool tabs. | `Issue #7443 `_ - Fixed and issue where 'Use spaces' not working in the query tool. | `Issue #7453 `_ - Fixed an issue where the Database restriction is not working. diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.ui.js b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.ui.js index 771e3c03b..9c443a86d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.ui.js @@ -161,7 +161,8 @@ export default class SubscriptionSchema extends BaseUISchema{ } }, { - id: 'password', label: gettext('Password'), type: 'password', maxlength: null, + id: 'password', label: gettext('Password'), type: 'password', + controlProps: { maxLength: null}, group: gettext('Connection'), mode: ['create', 'edit'], skipChange: true, deps: ['connect_now'], diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js b/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js index f25986de0..ad10012a2 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.ui.js @@ -210,13 +210,16 @@ export default class ServerSchema extends BaseUISchema { id: 'gss_encrypted', label: gettext('GSS encrypted?'), type: 'switch', group: gettext('Connection'), mode: ['properties'], visible: obj.isConnected, },{ - id: 'password', label: gettext('Password'), type: 'password', maxlength: null, + id: 'password', label: gettext('Password'), type: 'password', group: gettext('Connection'), mode: ['create'], deps: ['connect_now', 'kerberos_conn'], visible: function(state) { return state.connect_now && obj.isNew(state); }, + controlProps: { + maxLength: null + }, disabled: function(state) {return state.kerberos_conn;}, },{ id: 'save_password', label: gettext('Save password?'), @@ -396,6 +399,9 @@ export default class ServerSchema extends BaseUISchema { disabled: function(state) { return !state.use_ssh_tunnel; }, + controlProps: { + maxLength: null + }, readonly: obj.isConnected, }, { id: 'save_tunnel_password', label: gettext('Save password?'), diff --git a/web/pgadmin/browser/static/js/ConnectServerContent.jsx b/web/pgadmin/browser/static/js/ConnectServerContent.jsx index 7ddb4d13d..547fafaed 100644 --- a/web/pgadmin/browser/static/js/ConnectServerContent.jsx +++ b/web/pgadmin/browser/static/js/ConnectServerContent.jsx @@ -62,7 +62,7 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight} - onTextChange(e, 'tunnel_password')} onKeyDown={(e)=>onKeyDown(e)} /> @@ -85,7 +85,7 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight} /* Set only if no tunnel password asked */ firstEleRef.current = ele; } - }} type="password" value={formData['password']} maxLength={null} + }} type="password" value={formData['password']} controlProps={{maxLength:null}} onChange={(e)=>onTextChange(e, 'password')} onKeyDown={(e)=>onKeyDown(e)}/> diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx index 5b031b909..1b9742603 100644 --- a/web/pgadmin/static/js/components/FormComponents.jsx +++ b/web/pgadmin/static/js/components/FormComponents.jsx @@ -326,7 +326,9 @@ FormInputDateTimePicker.propTypes = { /* Use forwardRef to pass ref prop to OutlinedInput */ export const InputText = forwardRef(({ - cid, helpid, readonly, disabled, maxlength = 255, value, onChange, controlProps, type, ...props }, ref) => { + cid, helpid, readonly, disabled, value, onChange, controlProps, type, ...props }, ref) => { + + const maxlength = typeof(controlProps?.maxLength) != 'undefined' ? controlProps.maxLength : 255; const classes = useStyles(); const patterns = { @@ -388,7 +390,6 @@ InputText.propTypes = { label: PropTypes.string, readonly: PropTypes.bool, disabled: PropTypes.bool, - maxlength: PropTypes.number, value: PropTypes.any, onChange: PropTypes.func, controlProps: PropTypes.object, diff --git a/web/regression/javascript/components/FormComponents.spec.js b/web/regression/javascript/components/FormComponents.spec.js index d53dd41aa..be70cb272 100644 --- a/web/regression/javascript/components/FormComponents.spec.js +++ b/web/regression/javascript/components/FormComponents.spec.js @@ -74,10 +74,11 @@ describe('FormComponents', ()=>{ /* InputText */ readonly={false} disabled={false} - maxlength={50} + value={'thevalue'} controlProps={{ - extraprop: 'test' + extraprop: 'test', + maxLength: 50, }} />); });