mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-07-07 04:53:25 -05: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 #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 #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 #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 #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.
|
| `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) {
|
} else if(event.index == 2) {
|
||||||
/* Cancel button */
|
/* Cancel button */
|
||||||
self.masterpass_callback_queue = [];
|
self.masterpass_callback_queue = [];
|
||||||
|
self.cancel_callback();
|
||||||
} else if(event.index == 1) {
|
} else if(event.index == 1) {
|
||||||
/* Reset Button */
|
/* Reset Button */
|
||||||
event.cancel = true;
|
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;
|
let data=null, self = this;
|
||||||
|
|
||||||
data = JSON.stringify({
|
data = JSON.stringify({
|
||||||
|
@ -707,6 +710,7 @@ define('pgadmin.browser', [
|
||||||
});
|
});
|
||||||
|
|
||||||
self.masterpass_callback_queue.push(set_callback);
|
self.masterpass_callback_queue.push(set_callback);
|
||||||
|
self.cancel_callback = cancel_callback;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url_for('browser.set_master_password'),
|
url: url_for('browser.set_master_password'),
|
||||||
|
|
|
@ -61,7 +61,25 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
|
||||||
} else if(err.message){
|
} else if(err.message){
|
||||||
console.error('error msg', 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('');
|
setLoaderText('');
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((err) => {
|
||||||
Notify.alert(
|
|
||||||
gettext('Failed to retrieve data from the server.'),
|
|
||||||
gettext(e.message)
|
|
||||||
);
|
|
||||||
// show failed message.
|
// show failed message.
|
||||||
setLoaderText('');
|
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 {
|
} else {
|
||||||
setLoaderText('');
|
setLoaderText('');
|
||||||
|
|
|
@ -530,17 +530,11 @@ function SchemaDialogView({
|
||||||
});
|
});
|
||||||
setFormReady(true);
|
setFormReady(true);
|
||||||
setLoaderText('');
|
setLoaderText('');
|
||||||
}).catch((err)=>{
|
}).catch(()=>{
|
||||||
if(unmounted) {
|
if(unmounted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setLoaderText('');
|
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 */
|
/* Clear the focus timeout if unmounted */
|
||||||
return ()=>{
|
return ()=>{
|
||||||
|
@ -819,14 +813,8 @@ function SchemaPropertiesView({
|
||||||
setOrigData(data || {});
|
setOrigData(data || {});
|
||||||
setLoaderText('');
|
setLoaderText('');
|
||||||
}
|
}
|
||||||
}).catch((err)=>{
|
}).catch(()=>{
|
||||||
setLoaderText('');
|
setLoaderText('');
|
||||||
if (err.response && err.response.data && err.response.data.errormsg) {
|
|
||||||
Notify.alert(
|
|
||||||
gettext(err.response.statusText),
|
|
||||||
gettext(err.response.data.errormsg)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, [getInitData]);
|
}, [getInitData]);
|
||||||
|
|
||||||
|
|
|
@ -196,10 +196,14 @@ var Notifier = {
|
||||||
|
|
||||||
if(resp.info == 'CRYPTKEY_MISSING') {
|
if(resp.info == 'CRYPTKEY_MISSING') {
|
||||||
var pgBrowser = window.pgAdmin.Browser;
|
var pgBrowser = window.pgAdmin.Browser;
|
||||||
pgBrowser.set_master_password('', ()=> {
|
pgBrowser.set_master_password('', false, ()=> {
|
||||||
if(onJSONResult && typeof(onJSONResult) == 'function') {
|
if(onJSONResult && typeof(onJSONResult) == 'function') {
|
||||||
onJSONResult('CRYPTKEY_SET');
|
onJSONResult('CRYPTKEY_SET');
|
||||||
}
|
}
|
||||||
|
}, ()=> {
|
||||||
|
if(onJSONResult && typeof(onJSONResult) == 'function') {
|
||||||
|
onJSONResult('CRYPTKEY_NOT_SET');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
|
} else if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
|
||||||
|
|
Loading…
Reference in New Issue
Block a user