mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1. Added Master Password to increase the security of saved passwords. Fixes #4184
2. In server(web) mode, update all the saved server credentials when user password is changed. Fixes #3377
This commit is contained in:
committed by
Akshay Joshi
parent
6f0eafb223
commit
dfa892d2a2
@@ -607,32 +607,42 @@ define([
|
||||
*/
|
||||
$('.wizard-progress-bar p').show();
|
||||
|
||||
coll.fetch({
|
||||
success: function(c, xhr) {
|
||||
$('.wizard-progress-bar p').html('');
|
||||
$('.wizard-progress-bar').hide();
|
||||
c.set(xhr.result, {parse: true});
|
||||
// If some objects failed while fetching then we will notify the user
|
||||
if (xhr && xhr.info && xhr.info !== '') {
|
||||
$('.pg-prop-status-bar .alert-text').html(xhr.info);
|
||||
$('.pg-prop-status-bar').css('visibility', 'visible');
|
||||
}
|
||||
},
|
||||
error: function(m, xhr) {
|
||||
// If the main request fails as whole then
|
||||
let msg;
|
||||
if (xhr && xhr.responseJSON && xhr.responseJSON.errormsg) {
|
||||
msg = xhr.responseJSON.errormsg;
|
||||
}
|
||||
var fetchAjaxHook = function() {
|
||||
$('.wizard-progress-bar p').removeClass('alert-danger').addClass('alert-info');
|
||||
$('.wizard-progress-bar p').text(gettext('Please wait while fetching records...'));
|
||||
coll.fetch({
|
||||
success: function(c, xhr) {
|
||||
$('.wizard-progress-bar p').html('');
|
||||
$('.wizard-progress-bar').hide();
|
||||
c.set(xhr.result, {parse: true});
|
||||
// If some objects failed while fetching then we will notify the user
|
||||
if (xhr && xhr.info && xhr.info !== '') {
|
||||
$('.pg-prop-status-bar .alert-text').html(xhr.info);
|
||||
$('.pg-prop-status-bar').css('visibility', 'visible');
|
||||
}
|
||||
},
|
||||
error: function(model, xhr, options) {
|
||||
// If the main request fails as whole then
|
||||
$('.wizard-progress-bar p').removeClass('alert-info').addClass('alert-danger');
|
||||
$('.wizard-progress-bar p').text(gettext('Unable to fetch the database objects'));
|
||||
|
||||
if(!msg) {
|
||||
msg = gettext('Unable to fetch the database objects due to an error');
|
||||
}
|
||||
$('.wizard-progress-bar p').removeClass('alert-info').addClass('alert-danger');
|
||||
$('.wizard-progress-bar p').text(msg);
|
||||
},
|
||||
reset: true,
|
||||
}, this);
|
||||
Alertify.pgNotifier(
|
||||
options.textStatus, xhr,
|
||||
gettext('Unable to fetch the database objects'),
|
||||
function(msg) {
|
||||
if(msg === 'CRYPTKEY_SET') {
|
||||
fetchAjaxHook();
|
||||
} else {
|
||||
$('.wizard-progress-bar p').removeClass('alert-info').addClass('alert-danger');
|
||||
$('.wizard-progress-bar p').text(msg);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
reset: true,
|
||||
}, this);
|
||||
};
|
||||
fetchAjaxHook();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
##########################################################################
|
||||
|
||||
"""A blueprint module implementing the sqleditor frame."""
|
||||
import codecs
|
||||
import os
|
||||
import pickle
|
||||
import random
|
||||
import sys
|
||||
|
||||
import simplejson as json
|
||||
@@ -32,10 +30,11 @@ from pgadmin.tools.sqleditor.utils.update_session_grid_transaction import \
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils import get_storage_directory
|
||||
from pgadmin.utils.ajax import make_json_response, bad_request, \
|
||||
success_return, internal_server_error, unauthorized
|
||||
success_return, internal_server_error
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from pgadmin.utils.menu import MenuItem
|
||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost
|
||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\
|
||||
CryptKeyMissing
|
||||
from pgadmin.utils.sqlautocomplete.autocomplete import SQLAutoComplete
|
||||
from pgadmin.tools.sqleditor.utils.query_tool_preferences import \
|
||||
RegisterQueryToolPreferences
|
||||
@@ -176,7 +175,7 @@ def check_transaction_status(trans_id):
|
||||
use_binary_placeholder=True,
|
||||
array_to_string=True
|
||||
)
|
||||
except (ConnectionLost, SSHTunnelConnectionLost) as e:
|
||||
except (ConnectionLost, SSHTunnelConnectionLost, CryptKeyMissing):
|
||||
raise
|
||||
except Exception as e:
|
||||
current_app.logger.error(e)
|
||||
|
||||
@@ -2008,6 +2008,11 @@ define('tools.querytool', [
|
||||
this.warn_before_continue();
|
||||
}
|
||||
},
|
||||
handle_cryptkey_missing: function() {
|
||||
pgBrowser.set_master_password('', ()=>{
|
||||
this.warn_before_continue();
|
||||
});
|
||||
},
|
||||
warn_before_continue: function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ from pgadmin.tools.sqleditor.utils.update_session_grid_transaction import \
|
||||
update_session_grid_transaction
|
||||
from pgadmin.utils.ajax import make_json_response, internal_server_error
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost
|
||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\
|
||||
CryptKeyMissing
|
||||
|
||||
|
||||
class StartRunningQuery:
|
||||
@@ -63,7 +64,7 @@ class StartRunningQuery:
|
||||
auto_reconnect=False,
|
||||
use_binary_placeholder=True,
|
||||
array_to_string=True)
|
||||
except (ConnectionLost, SSHTunnelConnectionLost):
|
||||
except (ConnectionLost, SSHTunnelConnectionLost, CryptKeyMissing):
|
||||
raise
|
||||
except Exception as e:
|
||||
self.logger.error(e)
|
||||
@@ -134,7 +135,7 @@ class StartRunningQuery:
|
||||
# and formatted_error is True.
|
||||
try:
|
||||
status, result = conn.execute_async(sql)
|
||||
except (ConnectionLost, SSHTunnelConnectionLost):
|
||||
except (ConnectionLost, SSHTunnelConnectionLost, CryptKeyMissing):
|
||||
raise
|
||||
|
||||
# If the transaction aborted for some reason and
|
||||
|
||||
Reference in New Issue
Block a user