diff options
author | Camil Staps | 2015-05-13 12:32:27 +0200 |
---|---|---|
committer | Camil Staps | 2015-05-13 12:32:27 +0200 |
commit | f88789856be8a484bb1800a1b1695c2ac4b8a3b1 (patch) | |
tree | 3dd4bf80f70b4ff38f41059f1f32fe3471f260d4 /src/js/main.js | |
parent | Reload page on successful login (diff) |
Logout
Diffstat (limited to 'src/js/main.js')
-rw-r--r-- | src/js/main.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/js/main.js b/src/js/main.js index d3ab688..4444273 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -3,13 +3,24 @@ $(document).ready(function(){ // Show profile link instead of login if user is logged in var email = $.cookie(BotleaguesFrontend.cookie_login_email); if (typeof email != 'undefined' && $.cookie(BotleaguesFrontend.cookie_login_valid_till) > (new Date()).getTime()) { - $('#nav .login-link').remove(); - $('<li>').append( - $('<a>') - .attr('role', 'presentation') - .attr('title', 'User profile') - .attr('href', '/profile') - .text(email)) - .appendTo($('#nav')); + setupLoginMenu(email); } -});
\ No newline at end of file +}); + +function setupLoginMenu(email) { + $('#nav .login-link').remove(); + $('<li>').append( + $('<a>') + .attr('role', 'presentation') + .attr('title', 'User profile') + .attr('href', '/profile') + .text(email)) + .appendTo($('#nav')); + $('<li>').append( + $('<a>') + .attr('role', 'presentation') + .attr('title', 'Logout') + .attr('href', '/logout') + .text('Logout')) + .appendTo($('#nav')); +}
\ No newline at end of file |