diff options
-rw-r--r-- | nfsw/io.py | 12 | ||||
-rw-r--r-- | nfsw/static/io.js | 4 |
2 files changed, 15 insertions, 1 deletions
@@ -2,7 +2,7 @@ import functools import nfsw.scenes as scenes -from nfsw.auth import login_required, login_required_ajax +from nfsw.auth import login_required, login_required_ajax, logout from nfsw.redis import redis from nfsw.scenes import current_scene from nfsw.util import read_junk @@ -64,6 +64,16 @@ def query(): # Log query. r.rpush('log', q) + + # logout + if q == 'nfsw logout': + logout() + return { + 'ans': 'Logging you out...', + 'logout': True + } + + # help. if q == 'help': return { diff --git a/nfsw/static/io.js b/nfsw/static/io.js index 31483d0..aee1438 100644 --- a/nfsw/static/io.js +++ b/nfsw/static/io.js @@ -35,6 +35,10 @@ document.addEventListener('DOMContentLoaded', function() { ); } + if ('logout' in r && r.logout) { + return window.location.href = '/'; + } + if ('reset' in r && r.reset) { return window.location.href = '/epilogue'; } |