single connection support

This commit is contained in:
Jan Prochazka
2024-08-06 10:58:18 +02:00
parent 2440d6b75f
commit 5d6d827044
5 changed files with 32 additions and 10 deletions

View File

@@ -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;
},
};