summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/default/js/login.js20
-rw-r--r--themes/default/views/header.html.php2
2 files changed, 21 insertions, 1 deletions
diff --git a/themes/default/js/login.js b/themes/default/js/login.js
index e08897df..5acc711f 100644
--- a/themes/default/js/login.js
+++ b/themes/default/js/login.js
@@ -3,6 +3,10 @@ $(document).ready(function() {
process_login();
return false;
});
+ $("#gLogoutLink").click(function() {
+ process_logout();
+ return false;
+ });
});
function show_login() {
@@ -46,4 +50,20 @@ function process_login() {
}
}
});
+}
+
+function process_logout() {
+ $.ajax({
+ url: $("#gLogoutLink").attr("href"),
+ type: "GET",
+ dataType: "json",
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
+ alert("textStatus: " + textStatus + "\nerrorThrown: " + errorThrown);
+ },
+ success: function(data, textStatus) {
+ if (data.logout) {
+ window.location.reload();
+ }
+ }
+ });
} \ No newline at end of file
diff --git a/themes/default/views/header.html.php b/themes/default/views/header.html.php
index e427838b..f212bdb6 100644
--- a/themes/default/views/header.html.php
+++ b/themes/default/views/header.html.php
@@ -5,7 +5,7 @@
<div id="gLoginMenu">
<? if ($user): ?>
<a href="<?= url::site("user/update")?>"><?= _("Modify Profile") ?></a> |
- <a href="<?= url::site("logout")?>"><?= _("Logout") ?></a>
+ <a href="<?= url::site("login/logout")?>" id="gLogoutLink"><?= _("Logout") ?></a>
<? else: ?>
<a href="#"><?=_("Recover password") ?></a> |
<a href="<?= url::site("user/register")?>"><?= _("Register") ?></a> |