Fix handling of the logout button when inside the iframe

This commit is contained in:
Alexandre Aubin 2019-02-22 23:56:01 +01:00
parent ad27933f54
commit 3385732263
5 changed files with 26 additions and 12 deletions

View file

@ -347,6 +347,7 @@ function tweak_portal_when_in_iframe()
// Set class to body to show we're in overlay
document.body.classList.add('in_app_overlay');
let userContainer = document.querySelector('a.user-container');
if (userContainer) {
userContainer.classList.replace('user-container-info', 'user-container-edit');
userContainer.setAttribute('href', userContainer
.getAttribute('href')
@ -357,3 +358,16 @@ function tweak_portal_when_in_iframe()
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");
});
}
}

View file

@ -1,6 +1,6 @@
<div class="ynh-wrapper user">
<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>
<a class="user-container user-container-edit" href="info.html">

View file

@ -1,6 +1,6 @@
<div class="ynh-wrapper user">
<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>
<a class="user-container user-container-info" href="edit.html">

View file

@ -1,6 +1,6 @@
<div class="ynh-wrapper user">
<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>
<a class="user-container user-container-password" href="info.html">
<h2 class="user-username">{{{uid}}}</h2>