Hello,
Description
We’ve set up a custom script to automatically press the Connection button on login page to operate a seamless SSO login connection, but the custom script only works once every 10 times or so.
When it does work, the iframe inserted by the custom script can be found in the source code of the login page.
When it does not work, the iframe inserted by the custom script is not found in the source code of the login page.
Server Setup Information
- Version of Rocket.Chat Server: v3.1.1
- Operating System: CentOS
- Deployment Method: Docker image
- Number of Running Instances: 1
- DB Replicaset Oplog: ?
- NodeJS Version: v12.16.1
- MongoDB Version: 3.6.17
- Proxy: Apache
- Firewalls involved: no
Any additional Information
Here is the custom script that we’ve set up in the “custom scripts for logged out users” in the Layout section of the settings:
window.onload = (event) => {
const credentialToken = Random.id();
const login_url = "https://auth.domain.com/login";
if (!login_url) return;
const appUrl = Meteor.absoluteUrl().replace(/\/$/, '') + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
const delim = (login_url.split('?').length > 1) ? '&' : '?';
var i = document.createElement('iframe');
i.style.display = 'none';
i.onload = function() {
Accounts.callLoginMethod({
methodArguments: [{ cas: { credentialToken } }],
});
};
i.src = `${ login_url }${ delim }service=${ appUrl }/_cas/${ credentialToken }`;
document.body.appendChild(i);
};
Are you aware of any bugs related to custom scripts in this RC version?
Regards,
Frédéric.