1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/element_ynh.git synced 2024-09-03 18:36:08 +02:00

Fix SSO authentication

This commit is contained in:
Josué Tille 2019-10-27 11:46:34 +01:00
parent 39f5245ade
commit 483de6e6f9
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
3 changed files with 6 additions and 8 deletions

View file

@ -43,6 +43,7 @@
}, },
{ {
"name": "default_home_server", "name": "default_home_server",
"type": "domain",
"ask": { "ask": {
"en": "Chose a default home server", "en": "Chose a default home server",
"fr": "Choisissez un serveur par défault" "fr": "Choisissez un serveur par défault"

View file

@ -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\$]') 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 # 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 escape_string
match_string="${a//'unnamed_object'/'(\w+)'}" match_string="$a"
# We create a regular expression from the patch file # We create a regular expression from the patch file
a="$(cat ../sources/bundle_patch.js)" a="$(cat ../sources/bundle_patch.js)"
escape_string escape_string
a="${a//'unnamed_object'/'\1'}"
a="${a//'Lifecycle'/$Lifecycle_object_name}" a="${a//'Lifecycle'/$Lifecycle_object_name}"
a="$(echo "$a" | sed -r "s|//.*||g")" a="$(echo "$a" | sed -r "s|//.*||g")"
replace_string="$(echo $a)" replace_string="$(echo $a)"

View file

@ -1,4 +1,4 @@
case "start_login": case "view_welcome_page":
console.log('Try SSO Login'); console.log('Try SSO Login');
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.responseType = 'json'; xhr.responseType = 'json';
@ -17,9 +17,7 @@ case "start_login":
}); });
} else { } else {
console.log('SSO login failled, php page returned ' + xhr.status + ' error or returned an empty accessToken'); console.log('SSO login failled, php page returned ' + xhr.status + ' error or returned an empty accessToken');
thisobject.setStateForNewView({ thisobject._viewWelcome();
view: unnamed_object.LOGIN
}), thisobject.notifyNewScreen("login");
} }
}; };
xhr.send(JSON.stringify({ 'devicename' : this.props.defaultDeviceDisplayName })); xhr.send(JSON.stringify({ 'devicename' : this.props.defaultDeviceDisplayName }));