logout functionality

This commit is contained in:
Jan Prochazka 2022-03-21 20:54:40 +01:00
parent 26881a3e39
commit 77612cc6fb
3 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,7 @@ module.exports = [
{ command: 'group.saveAs', hideDisabled: true }, { command: 'group.saveAs', hideDisabled: true },
{ divider: true }, { divider: true },
{ command: 'file.exit', hideDisabled: true }, { command: 'file.exit', hideDisabled: true },
{ command: 'app.logout', hideDisabled: true },
], ],
}, },
{ {

View File

@ -38,10 +38,19 @@ module.exports = {
allowShellConnection: platformInfo.allowShellConnection, allowShellConnection: platformInfo.allowShellConnection,
allowShellScripting: platformInfo.allowShellConnection, allowShellScripting: platformInfo.allowShellConnection,
permissions, permissions,
login,
...currentVersion, ...currentVersion,
}; };
}, },
logout_meta: {
method: 'get',
raw: true,
},
logout(req, res) {
res.status(401).send('Logged out<br><a href="../..">Back to DbGate</a>');
},
platformInfo_meta: true, platformInfo_meta: true,
async platformInfo() { async platformInfo() {
return platformInfo; return platformInfo;

View File

@ -486,6 +486,16 @@ registerCommand({
onClick: () => getElectron().send('close-window'), onClick: () => getElectron().send('close-window'),
}); });
registerCommand({
id: 'app.logout',
category: 'App',
name: 'Logout',
testEnabled: () => getCurrentConfig()?.login != null,
onClick: () => {
window.location.href = 'config/logout';
},
});
export function registerFileCommands({ export function registerFileCommands({
idPrefix, idPrefix,
category, category,