diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-08-03 13:53:56 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-08-03 13:53:56 +0300 |
commit | 3038292daee114f22417495bfac4dcd105ee955a (patch) | |
tree | cfff0f1bff59759423b4082d6a9635cd13993ffa | |
download | ickweb-3038292daee114f22417495bfac4dcd105ee955a.tar.gz |
Add: initial commit
-rw-r--r-- | ickweb/__init__.py | 1 | ||||
-rw-r--r-- | ickweb/app.py | 22 | ||||
-rwxr-xr-x | run | 5 | ||||
-rw-r--r-- | views/index.tpl | 12 | ||||
-rw-r--r-- | views/login.tpl | 13 |
5 files changed, 53 insertions, 0 deletions
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 @@ -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 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta name="description" content="Facade content"> + <meta name="author" content="Qvarnlabs Ltd"> + <title>Facade content</title> + </head> + <body> + <p>You ARE logged in. Well done!</p> + </body> +</html> 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 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta name="description" content="Facade login"> + <meta name="author" content="Qvarnlabs Ltd"> + <title>Facade login</title> + </head> + <body> + <p>You are NOT logged in.</p> + <p><a href="https://qvisqve-demo.h.qvarnlabs.eu/login">Login</a></p> + </body> +</html> |