Merge pull request #3232 from dpalou/MOBILE-4022
MOBILE-4022 core: Use new setting autologinmintimebetweenreqmain
commit
fd65509190
|
@ -1746,12 +1746,23 @@ export class CoreSite {
|
||||||
* @return Promise resolved with the converted URL.
|
* @return Promise resolved with the converted URL.
|
||||||
*/
|
*/
|
||||||
async getAutoLoginUrl(url: string, showModal: boolean = true): Promise<string> {
|
async getAutoLoginUrl(url: string, showModal: boolean = true): Promise<string> {
|
||||||
if (!this.privateToken || (this.lastAutoLogin &&
|
if (!this.privateToken) {
|
||||||
CoreTimeUtils.timestamp() - this.lastAutoLogin < CoreConstants.SECONDS_MINUTE * 6)) {
|
// No private token, don't change the URL.
|
||||||
// No private token, WS not available or last auto-login was less than 6 minutes ago. Don't change the URL.
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.lastAutoLogin > 0) {
|
||||||
|
const timeBetweenRequests = await CoreUtils.ignoreErrors(
|
||||||
|
this.getConfig('tool_mobile_autologinmintimebetweenreq'),
|
||||||
|
CoreConstants.SECONDS_MINUTE * 6,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (CoreTimeUtils.timestamp() - this.lastAutoLogin < timeBetweenRequests) {
|
||||||
|
// Not enough time has passed since last auto login.
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const userId = this.getUserId();
|
const userId = this.getUserId();
|
||||||
const params = {
|
const params = {
|
||||||
privatetoken: this.privateToken,
|
privatetoken: this.privateToken,
|
||||||
|
|
Loading…
Reference in New Issue