mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 14:46:01 +00:00
single connection support
This commit is contained in:
@@ -34,12 +34,16 @@ module.exports = {
|
||||
const isLoginForm = authProvider.isLoginForm();
|
||||
const additionalConfigProps = authProvider.getAdditionalConfigProps();
|
||||
|
||||
const singleConnection = await authProvider.getSingleConnection(req);
|
||||
const singleConid = authProvider.getSingleConnectionId(req);
|
||||
|
||||
const singleConnection = singleConid
|
||||
? await connections.getCore({ conid: singleConid })
|
||||
: connections.singleConnection;
|
||||
|
||||
return {
|
||||
runAsPortal: !!connections.portalConnections,
|
||||
singleDbConnection: connections.singleDbConnection,
|
||||
singleConnection: connections.singleConnection,
|
||||
singleConnection: singleConnection,
|
||||
// hideAppEditor: !!process.env.HIDE_APP_EDITOR,
|
||||
allowShellConnection: platformInfo.allowShellConnection,
|
||||
allowShellScripting: platformInfo.allowShellScripting,
|
||||
|
||||
@@ -414,11 +414,17 @@ module.exports = {
|
||||
|
||||
dbloginAuth_meta: true,
|
||||
async dbloginAuth({ conid, user, password }) {
|
||||
const saveResp = await this.saveVolatile({ conid, user, password, test: true });
|
||||
if (saveResp.msgtype == 'connected') {
|
||||
const loginResp = await getAuthProvider().login(user, password, { conid: saveResp._id });
|
||||
return loginResp;
|
||||
if (user || password) {
|
||||
const saveResp = await this.saveVolatile({ conid, user, password, test: true });
|
||||
if (saveResp.msgtype == 'connected') {
|
||||
const loginResp = await getAuthProvider().login(user, password, { conid: saveResp._id });
|
||||
return loginResp;
|
||||
}
|
||||
return saveResp;
|
||||
}
|
||||
return saveResp;
|
||||
|
||||
// user and password is stored in connection, volatile connection is not needed
|
||||
const loginResp = await getAuthProvider().login(null, null, { conid });
|
||||
return loginResp;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user