-
Notifications
You must be signed in to change notification settings - Fork 20
/
logout.py
executable file
·43 lines (35 loc) · 1.11 KB
/
logout.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Basic logout page.
Author: Amir Zeldes
"""
import cgi
import os
from modules.logintools import logout
from modules.configobj import ConfigObj
from modules.pathutils import *
theform = cgi.FieldStorage()
scriptpath = os.path.dirname(os.path.realpath(__file__)) + os.sep
userdir = scriptpath + "users" + os.sep
config = ConfigObj(userdir + 'config.ini')
print(logout(userdir)) # printing cookie header. important!
print("Content-Type: text/html\n\n\n") # blank line: end of headers
templatedir = scriptpath + config['controltemplates'].replace("/",os.sep)
template = "main_header.html"
header = readfile(templatedir+template)
header = header.replace("**page_title**","Logged out")
header = header.replace('Logged in as: **user** (<a href="logout.py">log out</a>)',"")
header = header.replace("**open_disabled**",'')
header = header.replace("**user**",'(none)')
header = header.replace("**logout_control**",'')
print(header)
logout_footer = '''
<div id="control">
<p>You are now logged out</p>
<p><a href="open.py">Return to rstWeb</a></p>
</div>
</body>
</html>
'''
print(logout_footer)