Skip to content

Commit

Permalink
Merge pull request #3749 from NoelDeMartin/MOBILE-4390
Browse files Browse the repository at this point in the history
MOBILE-4390 lang: Set lang in login/token.php
  • Loading branch information
dpalou authored Jul 24, 2023
2 parents 4541958 + b8618cb commit c843090
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/services/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { asyncInstance, AsyncInstance } from '../utils/async-instance';
import { CoreConfig } from './config';
import { CoreNetwork } from '@services/network';
import { CoreUserGuestSupportConfig } from '@features/user/classes/support/guest-support-config';
import { CoreLang } from '@services/lang';

export const CORE_SITE_SCHEMAS = new InjectionToken<CoreSiteSchema[]>('CORE_SITE_SCHEMAS');
export const CORE_SITE_CURRENT_SITE_ID_CONFIG = 'current_site_id';
Expand Down Expand Up @@ -418,7 +419,10 @@ export class CoreSitesProvider {
siteUrl = CoreUrlUtils.removeUrlParams(siteUrl);

try {
data = await Http.post(siteUrl + '/login/token.php', { appsitecheck: 1 }).pipe(timeout(CoreWS.getRequestTimeout()))
const lang = await CoreLang.getCurrentLanguage();

data = await Http.post(`${siteUrl}/login/token.php?lang=${lang}`, { appsitecheck: 1 })
.pipe(timeout(CoreWS.getRequestTimeout()))
.toPromise();
} catch (error) {
throw this.createCannotConnectLoginError(null, {
Expand Down Expand Up @@ -480,12 +484,13 @@ export class CoreSitesProvider {
}

service = service || CoreConstants.CONFIG.wsservice;
const lang = await CoreLang.getCurrentLanguage();
const params = {
username,
password,
service,
};
const loginUrl = siteUrl + '/login/token.php';
const loginUrl = `${siteUrl}/login/token.php?lang=${lang}`;
let data: CoreSitesLoginTokenResponse;

try {
Expand Down

0 comments on commit c843090

Please sign in to comment.