From 354c7f92456cb05e60e0a7367813814b632d3a34 Mon Sep 17 00:00:00 2001 From: Fabien Del Olmo Date: Sat, 3 Oct 2020 14:50:31 +0200 Subject: [PATCH 1/2] Login issues #70 --- src/app/services/osmApi.service.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/app/services/osmApi.service.ts b/src/app/services/osmApi.service.ts index 914bfec59..266ef888c 100755 --- a/src/app/services/osmApi.service.ts +++ b/src/app/services/osmApi.service.ts @@ -104,7 +104,7 @@ export class OsmApiService { // DETAIL DE L'UTILISATEUR getUserDetail$(_user?, _password?, basicAuth = false, passwordSaved = true, test = false): Observable { - const PATH_API = '/api/0.6/user/details' + const PATH_API = '/api/0.6/user/details.json' let _observable; if (!basicAuth) { _observable = Observable.create( @@ -112,12 +112,12 @@ export class OsmApiService { this.auth.xhr({ method: 'GET', path: PATH_API, - options: { header: { 'Content-Type': 'text/xml' } }, + options: { header: { 'Content-Type': 'application/json' } }, }, (err, details) => { if (err) { observer.error({ response: err.response || '??', status: err.status || 0 }); } - observer.next(details) + observer.next(JSON.parse(details)) }); }) } else { @@ -126,25 +126,21 @@ export class OsmApiService { let headers = new HttpHeaders(); headers = headers .set('Authorization', `Basic ${btoa(_user + ':' + _password)}`) - .set('Content-Type', 'text/xml'); + .set('Content-Type', 'application/json'); - _observable = this.http.get(url, { headers: headers, responseType: 'text' }) - .pipe( - map(res => new DOMParser().parseFromString(res, 'text/xml')) - ) + _observable = this.http.get(url, { headers: headers}) + } return _observable.pipe( - map((res: Document) => { - const xml = res - const x_user = xml.getElementsByTagName('user')[0]; - const uid = x_user.getAttribute('id'); - const display_name = x_user.getAttribute('display_name'); + map((res: any) => { + const x_user = res.user; + const uid = x_user['id']; + const display_name = x_user['display_name']; const _userInfo: User = { user: _user, password: passwordSaved ?_password : null, uid: uid, display_name: display_name, connected: true, authType: basicAuth ? 'basic' : 'oauth',}; if (!test){ this.configService.setUserInfo(_userInfo); } - return _userInfo; }), catchError((error: any) => { From 4c2ae4afaa682d608f8e230dd3c1a9a69df55d0c Mon Sep 17 00:00:00 2001 From: Fabien Del Olmo Date: Sat, 3 Oct 2020 15:20:22 +0200 Subject: [PATCH 2/2] build 1.4.1 --- android/app/build.gradle | 4 ++-- package.json | 2 +- src/environments/environment.prod.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 59d38d928..8e9f0f82b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "fr.dogeo.osmgo" minSdkVersion 21 targetSdkVersion 29 - versionCode 12127 - versionName "1.4.0" + versionCode 12131 + versionName "1.4.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/package.json b/package.json index 78275345c..b3485f58c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "Fabien Del Olmo", "description": "Cartographiez les tous!", "homepage": "https://github.com/DoFabien/OsmGo", - "version": "1.4.0", + "version": "1.4.1", "scripts": { "ng": "ng", "start": "ng serve --host 0.0.0.0", diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 8acc58dd1..a0e0dfa90 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - version: '1.4.0' + version: '1.4.1' };