From 483de6e6f9951390347488e55f8fd20c8a0e673a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 27 Oct 2019 11:46:34 +0100 Subject: [PATCH] Fix SSO authentication --- manifest.json | 1 + scripts/_common.sh | 5 ++--- sources/bundle_patch.js | 8 +++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/manifest.json b/manifest.json index 21ab21e..0a4ecc0 100644 --- a/manifest.json +++ b/manifest.json @@ -43,6 +43,7 @@ }, { "name": "default_home_server", + "type": "domain", "ask": { "en": "Chose a default home server", "fr": "Choisissez un serveur par défault" diff --git a/scripts/_common.sh b/scripts/_common.sh index 79d5072..997e995 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -55,14 +55,13 @@ install_source() { Lifecycle_object_name=$(grep -P -o 'onLoggedIn:[\w\$]+\.setLoggedIn,' $final_path/bundles/*/bundle.js | grep -P -o ':[\w\$]+\.' | grep -P -o '[\w\$]') # We get the part witch we need to patch and create a regular expression - a='case"start_login":this.setStateForNewView({view:unnamed_object.LOGIN}),this.notifyNewScreen("login");break;' + a='case"view_welcome_page":this._viewWelcome();break' escape_string - match_string="${a//'unnamed_object'/'(\w+)'}" + match_string="$a" # We create a regular expression from the patch file a="$(cat ../sources/bundle_patch.js)" escape_string - a="${a//'unnamed_object'/'\1'}" a="${a//'Lifecycle'/$Lifecycle_object_name}" a="$(echo "$a" | sed -r "s|//.*||g")" replace_string="$(echo $a)" diff --git a/sources/bundle_patch.js b/sources/bundle_patch.js index 8469bfb..96783b5 100644 --- a/sources/bundle_patch.js +++ b/sources/bundle_patch.js @@ -1,4 +1,4 @@ -case "start_login": +case "view_welcome_page": console.log('Try SSO Login'); var xhr = new XMLHttpRequest(); xhr.responseType = 'json'; @@ -17,10 +17,8 @@ case "start_login": }); } else { console.log('SSO login failled, php page returned ' + xhr.status + ' error or returned an empty accessToken'); - thisobject.setStateForNewView({ - view: unnamed_object.LOGIN - }), thisobject.notifyNewScreen("login"); + thisobject._viewWelcome(); } }; xhr.send(JSON.stringify({ 'devicename' : this.props.defaultDeviceDisplayName })); - break; \ No newline at end of file + break;