Ensure that the Return key can be used to submit the Master Password dialogue. Fixes #4310

Ensure that browser auto-fill doesn't cause Help pages to be opened unexpectedly. Fixes #4317
This commit is contained in:
Dave Page 2019-06-10 14:03:56 +01:00
parent f561c0cee6
commit 2ca11c84e8
3 changed files with 18 additions and 19 deletions

View File

@ -17,4 +17,6 @@ Bug fixes
| `Bug #4195 <https://redmine.postgresql.org/issues/4195>`_ - Fix keyboard navigation in "inner" tabsets such as the Query Tool and Debugger.
| `Bug #4253 <https://redmine.postgresql.org/issues/4253>`_ - Fix issue where new column should be created with Default value.
| `Bug #4255 <https://redmine.postgresql.org/issues/4255>`_ - Prevent the geometry viewer grabbing key presses when not in focus under Firefox, IE and Edge.
| `Bug #4310 <https://redmine.postgresql.org/issues/4310>`_ - Ensure that the Return key can be used to submit the Master Password dialogue.
| `Bug #4317 <https://redmine.postgresql.org/issues/4317>`_ - Ensure that browser auto-fill doesn't cause Help pages to be opened unexpectedly.
| `Bug #4320 <https://redmine.postgresql.org/issues/4320>`_ - Fix issue where SSH tunnel connection using password is failing, it's regression of Master Password.

View File

@ -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:[{
@ -547,30 +550,13 @@ define('pgadmin.browser', [
},
prepare:function() {
let self = this;
let $password = null;
let $okBtn = $(self.__internal.buttons[3].element);
self.setContent(self.message);
$password = $(self.elements.body).find('#password');
/* Reset button hide */
if(!self.reset) {
$(self.__internal.buttons[1].element).addClass('d-none');
} else {
$(self.__internal.buttons[1].element).removeClass('d-none');
}
/* Enable ok only if password entered */
$okBtn.prop('disabled', true);
$password.on('input change keyup', (event)=>{
keyboardFunc._stopEventPropagation(event);
if($password.val() != '') {
$okBtn.prop('disabled', false);
} else {
$okBtn.prop('disabled', true);
}
});
},
callback: function(event) {
let parentDialog = this;

View File

@ -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) {