summaryrefslogtreecommitdiff
path: root/ickweb/app.py
blob: f4200983e59b287535970c0d52a00dea2de454c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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