mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-23 23:13:38 -06:00
Ensure that the master password dialog is popped up if the crypt key is missing. Fixes #6960
This commit is contained in:
parent
ae7059aec1
commit
38278c179e
@ -24,6 +24,7 @@ Bug fixes
|
||||
|
||||
| `Issue #4256 <https://redmine.postgresql.org/issues/4256>`_ - Fixed an issue where SQL for revoke statements are not shown for databases.
|
||||
| `Issue #5836 <https://redmine.postgresql.org/issues/5836>`_ - Adds a new LDAP authentication configuration parameter that indicates the case sensitivity of the LDAP schema/server.
|
||||
| `Issue #6960 <https://redmine.postgresql.org/issues/6960>`_ - Ensure that the master password dialog is popped up if the crypt key is missing.
|
||||
| `Issue #7059 <https://redmine.postgresql.org/issues/7059>`_ - Fixed an issue where the error is shown on logout when the authentication source is oauth2.
|
||||
| `Issue #7176 <https://redmine.postgresql.org/issues/7176>`_ - Fixed an issue where the browser tree state was not preserved correctly.
|
||||
| `Issue #7197 <https://redmine.postgresql.org/issues/7197>`_ - Fixed an issue where foreign key relationships do not update when the primary key is modified.
|
||||
|
@ -634,6 +634,7 @@ define('pgadmin.browser', [
|
||||
} else if(event.index == 2) {
|
||||
/* Cancel button */
|
||||
self.masterpass_callback_queue = [];
|
||||
self.cancel_callback();
|
||||
} else if(event.index == 1) {
|
||||
/* Reset Button */
|
||||
event.cancel = true;
|
||||
@ -698,7 +699,9 @@ define('pgadmin.browser', [
|
||||
});
|
||||
},
|
||||
|
||||
set_master_password: function(password='', button_click=false, set_callback=()=>{/*This is intentional (SonarQube)*/}) {
|
||||
set_master_password: function(password='', button_click=false,
|
||||
set_callback=()=>{/*This is intentional (SonarQube)*/},
|
||||
cancel_callback=()=>{/*This is intentional (SonarQube)*/}) {
|
||||
let data=null, self = this;
|
||||
|
||||
data = JSON.stringify({
|
||||
@ -707,6 +710,7 @@ define('pgadmin.browser', [
|
||||
});
|
||||
|
||||
self.masterpass_callback_queue.push(set_callback);
|
||||
self.cancel_callback = cancel_callback;
|
||||
|
||||
$.ajax({
|
||||
url: url_for('browser.set_master_password'),
|
||||
|
@ -61,7 +61,25 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
|
||||
} else if(err.message){
|
||||
console.error('error msg', err.message);
|
||||
}
|
||||
reject(err);
|
||||
|
||||
if (err?.response?.data?.info == 'CRYPTKEY_MISSING') {
|
||||
Notify.pgNotifier('error', err.request, 'The master password is not set', function(msg) {
|
||||
setTimeout(function() {
|
||||
if (msg == 'CRYPTKEY_SET') {
|
||||
resolve(initData());
|
||||
} else if (msg == 'CRYPTKEY_NOT_SET') {
|
||||
reject(err);
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
} else if (err?.response?.data?.errormsg) {
|
||||
Notify.alert(
|
||||
gettext(err.response.statusText),
|
||||
gettext(err.response.data.errormsg)
|
||||
);
|
||||
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -190,14 +190,27 @@ export default function Statistics({ nodeData, item, node, ...props }) {
|
||||
}
|
||||
setLoaderText('');
|
||||
})
|
||||
.catch((e) => {
|
||||
Notify.alert(
|
||||
gettext('Failed to retrieve data from the server.'),
|
||||
gettext(e.message)
|
||||
);
|
||||
.catch((err) => {
|
||||
// show failed message.
|
||||
setLoaderText('');
|
||||
setMsg(gettext('Failed to retrieve data from the server.'));
|
||||
|
||||
if (err?.response?.data?.info == 'CRYPTKEY_MISSING') {
|
||||
Notify.pgNotifier('error', err.request, 'The master password is not set', function(msg) {
|
||||
setTimeout(function() {
|
||||
if (msg == 'CRYPTKEY_SET') {
|
||||
setMsg('No statistics are available for the selected object.');
|
||||
} else if (msg == 'CRYPTKEY_NOT_SET') {
|
||||
setMsg(gettext('The master password is not set.'));
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
} else {
|
||||
Notify.alert(
|
||||
gettext('Failed to retrieve data from the server.'),
|
||||
gettext(err.message)
|
||||
);
|
||||
setMsg(gettext('Failed to retrieve data from the server.'));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setLoaderText('');
|
||||
|
@ -530,17 +530,11 @@ function SchemaDialogView({
|
||||
});
|
||||
setFormReady(true);
|
||||
setLoaderText('');
|
||||
}).catch((err)=>{
|
||||
}).catch(()=>{
|
||||
if(unmounted) {
|
||||
return;
|
||||
}
|
||||
setLoaderText('');
|
||||
if (err.response && err.response.data && err.response.data.errormsg) {
|
||||
Notify.alert(
|
||||
gettext(err.response.statusText),
|
||||
gettext(err.response.data.errormsg)
|
||||
);
|
||||
}
|
||||
});
|
||||
/* Clear the focus timeout if unmounted */
|
||||
return ()=>{
|
||||
@ -819,14 +813,8 @@ function SchemaPropertiesView({
|
||||
setOrigData(data || {});
|
||||
setLoaderText('');
|
||||
}
|
||||
}).catch((err)=>{
|
||||
}).catch(()=>{
|
||||
setLoaderText('');
|
||||
if (err.response && err.response.data && err.response.data.errormsg) {
|
||||
Notify.alert(
|
||||
gettext(err.response.statusText),
|
||||
gettext(err.response.data.errormsg)
|
||||
);
|
||||
}
|
||||
});
|
||||
}, [getInitData]);
|
||||
|
||||
|
@ -196,10 +196,14 @@ var Notifier = {
|
||||
|
||||
if(resp.info == 'CRYPTKEY_MISSING') {
|
||||
var pgBrowser = window.pgAdmin.Browser;
|
||||
pgBrowser.set_master_password('', ()=> {
|
||||
pgBrowser.set_master_password('', false, ()=> {
|
||||
if(onJSONResult && typeof(onJSONResult) == 'function') {
|
||||
onJSONResult('CRYPTKEY_SET');
|
||||
}
|
||||
}, ()=> {
|
||||
if(onJSONResult && typeof(onJSONResult) == 'function') {
|
||||
onJSONResult('CRYPTKEY_NOT_SET');
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
|
||||
|
Loading…
Reference in New Issue
Block a user