MOBILE-2791 login: Fix get site policy when recently added
parent
f5115c56e1
commit
35163f473c
|
@ -335,15 +335,15 @@ export class CoreLoginHelperProvider {
|
||||||
*/
|
*/
|
||||||
getSitePolicy(siteId?: string): Promise<string> {
|
getSitePolicy(siteId?: string): Promise<string> {
|
||||||
return this.sitesProvider.getSite(siteId).then((site) => {
|
return this.sitesProvider.getSite(siteId).then((site) => {
|
||||||
// Check if it's stored in the site config.
|
// Try to get the latest config, maybe the site policy was just added or has changed.
|
||||||
const sitePolicy = site.getStoredConfig('sitepolicy');
|
return site.getConfig('sitepolicy', true).then((sitePolicy) => {
|
||||||
if (typeof sitePolicy != 'undefined') {
|
|
||||||
return sitePolicy ? sitePolicy : Promise.reject(null);
|
return sitePolicy ? sitePolicy : Promise.reject(null);
|
||||||
}
|
}, () => {
|
||||||
|
// Cannot get config, try to get the site policy using auth_email_get_signup_settings.
|
||||||
// Not in the config, try to get it using auth_email_get_signup_settings.
|
return this.wsProvider.callAjax('auth_email_get_signup_settings', {}, { siteUrl: site.getURL() })
|
||||||
return this.wsProvider.callAjax('auth_email_get_signup_settings', {}, { siteUrl: site.getURL() }).then((settings) => {
|
.then((settings) => {
|
||||||
return settings.sitepolicy ? settings.sitepolicy : Promise.reject(null);
|
return settings.sitepolicy ? settings.sitepolicy : Promise.reject(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue