Show appropriate error message when master password is not set instead of 'Crypt key missing'. #5735

This commit is contained in:
Aditya Toshniwal
2023-03-13 11:51:35 +05:30
committed by GitHub
parent 66c4b9d05a
commit ec32099d2f
3 changed files with 26 additions and 12 deletions

View File

@@ -29,6 +29,9 @@ jobs:
- name: Install requirements
run: pip install -r requirements.txt
- name: Install pyOpenSSL
run: pip install "pyOpenSSL>=23.*"
- name: Install sphinx
run: pip install sphinx

View File

@@ -56,15 +56,14 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
resolve(res.data);
})
.catch((err)=>{
if(err.response){
console.error('error resp', err.response);
} else if(err.request){
console.error('error req', err.request);
} else if(err.message){
console.error('error msg', err.message);
}
reject(err);
Notify.pgRespErrorNotify(err);
Notify.pgNotifier('error', err, '', function(msg) {
if (msg == 'CRYPTKEY_SET') {
return Promise.resolve(initData());
} else if (msg == 'CRYPTKEY_NOT_SET') {
reject(gettext('The master password is not set.'));
}
reject(err);
});
});
}
});
@@ -81,7 +80,14 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
resolve(res.data);
onSave && onSave(res.data);
}).catch((err)=>{
reject(err);
Notify.pgNotifier('error', err, '', function(msg) {
if (msg == 'CRYPTKEY_SET') {
return Promise.resolve(onSaveClick(isNew, data));
} else if (msg == 'CRYPTKEY_NOT_SET') {
reject(gettext('The master password is not set.'));
}
reject(err);
});
});
});

View File

@@ -595,11 +595,15 @@ function SchemaDialogView({
});
setFormReady(true);
setLoaderText('');
}).catch(()=>{
}).catch((err)=>{
if(unmounted) {
return;
}
setLoaderText('');
setFormErr({
name: 'apierror',
message: _.escape(parseApiError(err)),
});
});
/* Clear the focus timeout if unmounted */
return ()=>{
@@ -892,8 +896,9 @@ function SchemaPropertiesView({
});
setLoaderText('');
}
}).catch(()=>{
}).catch((err)=>{
setLoaderText('');
Notify.pgRespErrorNotify(err);
});
}, []);