in prevision for django-1.7, rename our local auth module into localauth to avoid...
[myslice.git] / localauth / static / js / logout.js
1 /* retrieve username from the button that is clicked, the one named 'logout' 
2    and that is expected to have the 'username' attribute */
3 function logout () {
4     var username=$(this).data('username');
5     var msg="Are you sure you want to logout as " + username + " ?";
6     /* redirect to /logout, see urls.py */
7     if (confirm(msg)){
8         localStorage.clear();
9         window.location="/logout/";
10     }
11 }
12 /* attach this function to the logout button */
13 $(document).ready(function() { $('#logout').click(logout); $('#logoutbtn').click(logout); });