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",
"type": "domain",
"ask": {
"en": "Chose a default home server",
"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\$]')
# 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)"

View file

@ -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;
break;