public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM4310] User can not connect to the Master Password with Enter button
Date: Wed, 5 Jun 2019 12:43:37 +0530
Message-ID: <CAM9w-_mhLAoL3ZgY3w8SCH6WbSF=_11tU3Ueh-voAWkfgVZtVw@mail.gmail.com> (raw)

Hi Hackers,

Attached is the patch to fix an issue where using browser autofills in
alertify dialogs triggers the help page button (#4317).
A workaround was added to master password dialog to avoid this, but that in
turn disabled the 'OK' button tigger on pressing enter button. This is also
fixed with this patch.(#4310)

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] RM4310_4317.patch (2.9K, 3-RM4310_4317.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index 4af69603..54076c63 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -12,7 +12,7 @@ define('pgadmin.browser', [
   'sources/gettext', 'sources/url_for', 'require', 'jquery', 'underscore', 'underscore.string',
   'bootstrap', 'sources/pgadmin', 'pgadmin.alertifyjs', 'bundled_codemirror',
   'sources/check_node_visibility', './toolbar', 'pgadmin.help',
-  'sources/csrf', 'sources/keyboard_shortcuts', 'pgadmin.browser.utils',
+  'sources/csrf', 'pgadmin.browser.utils',
   'wcdocker', 'jquery.contextmenu', 'jquery.aciplugin', 'jquery.acitree',
   'pgadmin.browser.preferences', 'pgadmin.browser.messages',
   'pgadmin.browser.menu', 'pgadmin.browser.panel', 'pgadmin.browser.layout',
@@ -24,7 +24,7 @@ define('pgadmin.browser', [
   tree,
   gettext, url_for, require, $, _, S,
   Bootstrap, pgAdmin, Alertify, codemirror,
-  checkNodeVisibility, toolBar, help, csrfToken, keyboardFunc
+  checkNodeVisibility, toolBar, help, csrfToken
 ) {
   window.jQuery = window.$ = $;
   // Some scripts do export their object in the window only.
@@ -518,6 +518,9 @@ define('pgadmin.browser', [
               this.message = message;
               this.reset = reset;
             },
+            build: function() {
+              Alertify.pgDialogBuild.apply(this);
+            },
             setup:function() {
               return {
                 buttons:[{
@@ -562,9 +565,7 @@ define('pgadmin.browser', [
 
               /* Enable ok only if password entered */
               $okBtn.prop('disabled', true);
-              $password.on('input change keyup', (event)=>{
-                keyboardFunc._stopEventPropagation(event);
-
+              $password.on('input change', ()=>{
                 if($password.val() != '') {
                   $okBtn.prop('disabled', false);
                 } else {
diff --git a/web/pgadmin/static/js/alertify.pgadmin.defaults.js b/web/pgadmin/static/js/alertify.pgadmin.defaults.js
index 8150399b..592c1e56 100644
--- a/web/pgadmin/static/js/alertify.pgadmin.defaults.js
+++ b/web/pgadmin/static/js/alertify.pgadmin.defaults.js
@@ -266,6 +266,17 @@ define([
     this.set('onresized', alertifyDialogResized.bind(this, true));
     this.set('onmaximized', alertifyDialogResized);
     this.set('onrestored', alertifyDialogResized);
+
+    /* Set the key to null if it is not defined
+     * When Browser autofill drop down value is clicked it raises a keyup event
+     * with undefined keyCode. The undefined keyCode matches the undefined key
+     * of alertify and triggers the button
+     */
+    for(let i=0; i<this.__internal.buttons.length; i++) {
+      if(_.isUndefined(this.__internal.buttons[i]['key'])) {
+        this.__internal.buttons[i]['key'] = null;
+      }
+    }
   };
 
   alertify.pgHandleItemError = function(xhr, error, message, args) {


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM4310] User can not connect to the Master Password with Enter button
  In-Reply-To: <CAM9w-_mhLAoL3ZgY3w8SCH6WbSF=_11tU3Ueh-voAWkfgVZtVw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox