Skip to content

Commit

Permalink
added logout page in configuration #542
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Letter committed Dec 9, 2015
1 parent c236e69 commit 83aef3e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/slycat/web/server/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def log_configuration(tree, indent=""):

authentication = configuration["slycat-web-server"]["authentication"]["plugin"]
configuration["/"]["tools.%s.on" % authentication] = True
# configuration["/logout"]["tools.%s.on" % authentication] = False
for key, value in configuration["slycat-web-server"]["authentication"]["kwargs"].items():
configuration["/"]["tools.%s.%s" % (authentication, key)] = value

Expand Down Expand Up @@ -206,7 +207,14 @@ def log_configuration(tree, indent=""):
"tools.staticdir.dir": abspath("templates"),
"tools.staticdir.on": True,
}

configuration["/logout.html"] = {
"tools.expires.force": True,
"tools.expires.on": True,
"tools.expires.secs": 3600,
"tools.%s.on" % authentication : False,
"tools.staticfile.filename": abspath("logout.html"),
"tools.staticfile.on": True,
}
# Load plugin modules.
manager = slycat.web.server.plugin.manager
for item in configuration["slycat-web-server"]["plugins"]:
Expand Down Expand Up @@ -241,5 +249,5 @@ def log_configuration(tree, indent=""):
cherrypy.config.update({ 'error_page.404': os.path.join(root_path, "templates/slycat-404.html") })

# Start the web server.
cherrypy.quickstart(None, "/", configuration)
cherrypy.quickstart(None, "", configuration)

48 changes: 48 additions & 0 deletions web-server/logout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>401</title>

<style type="text/css" media="screen">
html {
height: 100%%;
}

body {
height: 100%%;
background-color: #F2F2F2;
background-repeat: no-repeat;
background-position: 50%% 15%%;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}

.not-found {
font-size: 74px;
font-weight: bold;
text-align: center;
margin-top: 28%%;
}

.return-home {
text-align: center;
margin-top: 1%%;
}

.return-home a {
font-weight: bold;
color: black;
}
</style>
</head>

<body>
<div class="not-found">
You Are Logged Out
</div>
<div class="return-home">
<a href="/">Slycat Homepage</a>
</div>
</body>
</html>

0 comments on commit 83aef3e

Please sign in to comment.