Esempio n. 1
0
class Root(object):

    spreadsheet = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" href="/jquerytheme.css" type="text/css" media="screen, projection" />
<script type="text/javascript" src="/jquery.js" ></script>
<script type="text/javascript" src="/jquery-ui.js" ></script>
<script type="text/javascript" src="/static/js/jeditable.js" ></script>
<script type="text/javascript" src="/spreadsheet.js" ></script>
</head>
<body id="spreadsheet_example">
<div id="example"></div>
<p id="logging">
</p>
<script type="text/javascript">
$("#example").sheet({cols:8,rows:10});
</script>
</body>
</html>
	'''

    # CHANGED, we mount an instance of the Logon class
    logon = logon.Logon(path='/logon')

    @cherrypy.expose
    def index(self):
        # CHANGED, before serving the sheet, we authenticate the user. No returnpage argument is needed
        # as the defautl one is /
        username = logon.checkauth('/logon')
        return Root.spreadsheet
Esempio n. 2
0
class Root(object):

    logon = logon.Logon(path="/logon",
                        authenticated="/",
                        not_authenticated="/goaway")

    @cherrypy.expose
    def index(self):
        username = logon.checkauth('/logon')
        return '<html><body><p>Hello user <b>%s</b></p></body></html>' % username

    @cherrypy.expose
    def goaway(self):
        return '<html><body><h1>Not authenticated, please go away.</h1></body></html>'

    goaway._cp_config = {
        'tools.expires.on': True,
        'tools.expires.secs': 0,
        'tools.expires.force': True
    }

    @cherrypy.expose
    def somepage(self):
        username = logon.checkauth('/logon', returntopage=True)
        return '<html><body><h1>This is some page.</h1></body></html>'
Esempio n. 3
0
class Root(object):
	task = task.Task(logoffpath="/logon/logoff")

	logon = logon.Logon(path="/logon", authenticated="/task", not_authenticated="/")
	
	@cherrypy.expose
	def index(self):
		return Root.logon.index()
Esempio n. 4
0
class Root(object):

    apps = Apps()
    logon = logon.Logon(path="/logon",
                        authenticated="/apps/task",
                        not_authenticated="/")

    @cherrypy.expose
    def index(self):
        return Root.logon.index()
Esempio n. 5
0
class Root(object):

	apps = Apps()
	logon = logon.Logon(path="/logon", authenticated="/apps/task", not_authenticated="/")
	
	@cherrypy.expose
	def index(self):
		return Root.logon.index()
	
	#adding the output to host and port
	cherrypy.config.update({
                'server.socket_host': '0.0.0.0',
                'server.socket_port': 8088,
	})
Esempio n. 6
0
class Root(object):
    task = task.Task(logoffpath="/logon/logoff")

    #Serving APP from /task to /apps/task/
    logon = logon.Logon(path="/logon",
                        authenticated="/task",
                        not_authenticated="/")
    #logon = logon.Logon(path="/logon", authenticated="/apps/task", not_authenticated="/")

    @cherrypy.expose
    def index(self):
        return Root.logon.index()

    #adding the output to host and port
    cherrypy.config.update({
        'server.socket_host': '0.0.0.0',
        'server.socket_port': 8088,
    })