Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
update connectionmanager.js
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Jun 4, 2020
1 parent e777a28 commit 0f6f280
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions connectionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ function mergeServers(credentialProvider, list1, list2) {

function updateServerInfo(server, systemInfo) {

server.Name = systemInfo.ServerName;

if (systemInfo.ServerName) {
server.Name = systemInfo.ServerName;
}
if (systemInfo.Id) {
server.Id = systemInfo.Id;
}
Expand Down Expand Up @@ -426,7 +427,14 @@ export default class ConnectionManager {
apiClient.serverInfo(server);
afterConnected(apiClient, options);

return onLocalUserSignIn(server, apiClient.serverAddress());
return apiClient.getPublicSystemInfo().then(function (systemInfo) {

updateServerInfo(server, systemInfo);
credentialProvider.addOrUpdateServer(credentials.Servers, server);
credentialProvider.credentials(credentials);

return onLocalUserSignIn(server, apiClient.serverAddress());
});
}

function afterConnected(apiClient, options = {}) {
Expand Down Expand Up @@ -574,7 +582,7 @@ export default class ConnectionManager {
}).then(systemInfo => {

updateServerInfo(server, systemInfo);
return Promise.resolve();
return systemInfo;

}, () => {

Expand Down Expand Up @@ -1005,16 +1013,11 @@ export default class ConnectionManager {

options = options || {};

if (options.enableAutoLogin === false) {

//server.UserId = null;
//server.AccessToken = null;

} else if (verifyLocalAuthentication && server.AccessToken && options.enableAutoLogin !== false) {
if (verifyLocalAuthentication && server.AccessToken) {

validateAuthentication(server, serverUrl).then(() => {
validateAuthentication(server, serverUrl).then((fullSystemInfo) => {

afterConnectValidated(server, credentials, systemInfo, connectionMode, serverUrl, false, options, resolve);
afterConnectValidated(server, credentials, fullSystemInfo || systemInfo, connectionMode, serverUrl, false, options, resolve);
});

return;
Expand Down

0 comments on commit 0f6f280

Please sign in to comment.