mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Fix handling of the logout button when inside the iframe
This commit is contained in:
parent
ad27933f54
commit
3385732263
5 changed files with 26 additions and 12 deletions
|
@ -347,6 +347,7 @@ function tweak_portal_when_in_iframe()
|
||||||
// Set class to body to show we're in overlay
|
// Set class to body to show we're in overlay
|
||||||
document.body.classList.add('in_app_overlay');
|
document.body.classList.add('in_app_overlay');
|
||||||
let userContainer = document.querySelector('a.user-container');
|
let userContainer = document.querySelector('a.user-container');
|
||||||
|
if (userContainer) {
|
||||||
userContainer.classList.replace('user-container-info', 'user-container-edit');
|
userContainer.classList.replace('user-container-info', 'user-container-edit');
|
||||||
userContainer.setAttribute('href', userContainer
|
userContainer.setAttribute('href', userContainer
|
||||||
.getAttribute('href')
|
.getAttribute('href')
|
||||||
|
@ -357,3 +358,16 @@ function tweak_portal_when_in_iframe()
|
||||||
window.parent.location.href = userContainer.getAttribute('href');
|
window.parent.location.href = userContainer.getAttribute('href');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
let logoutButton = document.getElementById('ynh-logout');
|
||||||
|
if (logoutButton)
|
||||||
|
{
|
||||||
|
// We force to do the logout "globally", not just in the
|
||||||
|
// iframe, otherwise after login out the url might still be
|
||||||
|
// domain.tld/app which is weird ...
|
||||||
|
window.addEvent(logoutButton, 'click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
window.parent.location.href = logoutButton.getAttribute("href");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="ynh-wrapper user">
|
<div class="ynh-wrapper user">
|
||||||
<ul class="user-menu">
|
<ul class="user-menu">
|
||||||
<li><a class="icon icon-connexion" href="?action=logout">{{t_logout}}</a></li>
|
<li><a id="ynh-logout" class="icon icon-connexion" href="?action=logout">{{t_logout}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a class="user-container user-container-edit" href="info.html">
|
<a class="user-container user-container-edit" href="info.html">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="ynh-wrapper user">
|
<div class="ynh-wrapper user">
|
||||||
<ul class="user-menu">
|
<ul class="user-menu">
|
||||||
<li><a class="icon icon-connexion" href="?action=logout">{{t_logout}}</a></li>
|
<li><a id="ynh-logout" class="icon icon-connexion" href="?action=logout">{{t_logout}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a class="user-container user-container-info" href="edit.html">
|
<a class="user-container user-container-info" href="edit.html">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="ynh-wrapper user">
|
<div class="ynh-wrapper user">
|
||||||
<ul class="user-menu">
|
<ul class="user-menu">
|
||||||
<li><a class="icon icon-connexion" href="?action=logout">{{t_logout}}</a></li>
|
<li><a id="ynh-logout" class="icon icon-connexion" href="?action=logout">{{t_logout}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<a class="user-container user-container-password" href="info.html">
|
<a class="user-container user-container-password" href="info.html">
|
||||||
<h2 class="user-username">{{{uid}}}</h2>
|
<h2 class="user-username">{{{uid}}}</h2>
|
||||||
|
|
Loading…
Reference in a new issue