aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui/controllers/main.py
blob: fb925d3423b941bd6d6c1da717ba3b6b130ee099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import web
from tui import config
from tui import view
from tui.view import render
from tui.utils import session 

"""
The main page for network configuration
"""
class index:
  def GET(self):
    if session.is_logged() > 0:
      return render.base(render.index())
    else:
      return render.base(render.login())

  def POST(self):
    if session.check_login(web.input()) == 0:
      return render.base(render.index())
    else:
      return render.base(render.login())

class logout:
  def GET(self):
    session.logout()
    return render.base(render.logout())