diff options
Diffstat (limited to 'sca-cpp/trunk/modules/edit/htdocs/index.html')
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/index.html | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/index.html b/sca-cpp/trunk/modules/edit/htdocs/index.html index 0a57717a06..3bc1529dbb 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/index.html @@ -260,7 +260,7 @@ function showmenu(mdiv, view, appname) { ui.menu(isNil(config.compose)? 'Composition' : config.compose, '/#view=graph&app=' + appname, '_view', view == 'graph'))), mklist( ui.menu('Account', '/#view=account', '_view', view == 'account'), - ui.signedin()? ui.menu('Sign out', '/logout/', '_self', false) : ui.menu('Sign in', '/login/', '_self', false))); + ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } /** @@ -423,6 +423,27 @@ window.onnavigate = function(url) { }; /** + * Handle login redirect. + */ +window.onloginredirect = function(e) { + document.location = '/login/'; +}; + +/** + * Log the current user out. + */ +function logout() { + // Clear session cookie and user-specific local storage entries + var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; + document.cookie = reset; + localStorage.removeItem('/r/EditWidget/accounts'); + localStorage.removeItem('/r/EditWidget/dashboards'); + //localStorage.clear(); + document.location = '/login/'; + return true; +} + +/** * Handle history. */ window.addEventListener('popstate', function(e) { |