Skip to content

Commit

Permalink
Better detection for login #3264
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Aug 26, 2024
1 parent 549681e commit bd26aa5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions grails-app/assets/javascripts/base-bs4.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ function setupTimeoutWarning(options) {
window.addEventListener('offline', function() {
fireKeepAlive();
});
window.addEventListener('visibilitychange', function() {
if (!document.hidden) {
fireKeepAlive();
}
});


}
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,16 @@ class HomeController {
renderStaticPage(SettingPageType.CONTACTS, false)
}

/**
* Returns a small amount of javascript to let other tabs know the user has been logged back in
* and closes the tab.
*/
def close() {
response.setContentType("text/html")
render """<html><head><script type="text/javascript">window.close();</script></head><body/></html>"""
render """<html><head><script type="text/javascript">
localStorage.setItem('login', new Date());
window.close();
</script></head><body/></html>"""
}

def staticPage(String id) {
Expand Down

0 comments on commit bd26aa5

Please sign in to comment.