From 3038292daee114f22417495bfac4dcd105ee955a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 3 Aug 2018 13:53:56 +0300 Subject: Add: initial commit --- ickweb/__init__.py | 1 + ickweb/app.py | 22 ++++++++++++++++++++++ run | 5 +++++ views/index.tpl | 12 ++++++++++++ views/login.tpl | 13 +++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 ickweb/__init__.py create mode 100644 ickweb/app.py create mode 100755 run create mode 100644 views/index.tpl create mode 100644 views/login.tpl diff --git a/ickweb/__init__.py b/ickweb/__init__.py new file mode 100644 index 0000000..819ccf0 --- /dev/null +++ b/ickweb/__init__.py @@ -0,0 +1 @@ +from .app import create_app diff --git a/ickweb/app.py b/ickweb/app.py new file mode 100644 index 0000000..f420098 --- /dev/null +++ b/ickweb/app.py @@ -0,0 +1,22 @@ +import bottle + + +COOKIE = 'ickweb1' + + +def create_app(): + app = bottle.Bottle() + + @app.route('/') + def root(): + if bottle.request.get_cookie(COOKIE) == 'yes': + return bottle.template('index') + else: + return bottle.template('login') + + @app.route('/callback') + def callback(): + bottle.response.set_cookie(ICKWEB, 'yes') + bottle.redirect('/') + + return app diff --git a/run b/run new file mode 100755 index 0000000..0d1f411 --- /dev/null +++ b/run @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +import ickweb + +ickweb.create_app().run(host='localhost', port=8080) diff --git a/views/index.tpl b/views/index.tpl new file mode 100644 index 0000000..20ba140 --- /dev/null +++ b/views/index.tpl @@ -0,0 +1,12 @@ + + + + + + + Facade content + + +

You ARE logged in. Well done!

+ + diff --git a/views/login.tpl b/views/login.tpl new file mode 100644 index 0000000..f983ac0 --- /dev/null +++ b/views/login.tpl @@ -0,0 +1,13 @@ + + + + + + + Facade login + + +

You are NOT logged in.

+

Login

+ + -- cgit v1.2.1