Check validity on each modules
This commit is contained in:
parent
14e42bc0d4
commit
56586d1d5d
@ -22,16 +22,15 @@ class home:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def html(self, params):
|
def html(self, params):
|
||||||
|
|
||||||
active_page = "Home"
|
active_page = "Home"
|
||||||
allowed_roles = [0,1,2,3]
|
allowed_roles = [0,1,2,3]
|
||||||
|
|
||||||
beaker_session = request.environ.get('beaker.session')
|
beaker_session = request.environ.get('beaker.session')
|
||||||
jwt = beaker_session["token"] if "token" in beaker_session else None
|
jwt = beaker_session["token"] if "token" in beaker_session else None
|
||||||
if jwt is not None:
|
self.user = procedure_session.session().user(jwt, allowed_roles) if jwt is not None else self.user
|
||||||
self.user = procedure_session.session().user(jwt, allowed_roles)
|
|
||||||
user = self.user['data']
|
user = self.user['data']
|
||||||
|
if 'valid' in user and user['valid']['status'] == 0:
|
||||||
|
return redirect('/logout')
|
||||||
|
else:
|
||||||
return Template(params["mako"]["website"]['index']).render(
|
return Template(params["mako"]["website"]['index']).render(
|
||||||
title = globalvar.title,
|
title = globalvar.title,
|
||||||
header = globalvar.header,
|
header = globalvar.header,
|
||||||
|
@ -1,22 +1,26 @@
|
|||||||
import mysql.connector as mariadb
|
|
||||||
from mako.template import Template
|
from mako.template import Template
|
||||||
from config import globalvar, database
|
from config import globalvar
|
||||||
|
from bottle import request
|
||||||
|
|
||||||
class login:
|
class login:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.db_main = mariadb.connect(**database.db_main)
|
pass
|
||||||
self.cursor = self.db_main.cursor(dictionary=True)
|
|
||||||
self.user_roles = [0] # Cari user roles disini
|
|
||||||
|
|
||||||
def html(self, params):
|
def html(self, params):
|
||||||
active_page = "Login"
|
active_page = "Login"
|
||||||
|
user_roles = [0]
|
||||||
|
beaker_session = request.environ.get('beaker.session')
|
||||||
|
jwt = beaker_session["token"] if "token" in beaker_session else None
|
||||||
|
if jwt is not None:
|
||||||
|
return redirect('/')
|
||||||
|
else:
|
||||||
return Template(params["mako"]["website"]['index']).render(
|
return Template(params["mako"]["website"]['index']).render(
|
||||||
title = globalvar.title,
|
title = globalvar.title,
|
||||||
header = globalvar.header,
|
header = globalvar.header,
|
||||||
navbar = Template(params["mako"]["website"]['navbar']).render(
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
||||||
menu = globalvar.menu['public']['navbar'],
|
menu = globalvar.menu['public']['navbar'],
|
||||||
user_roles = self.user_roles,
|
user_roles = user_roles,
|
||||||
active_page = active_page
|
active_page = active_page
|
||||||
),
|
),
|
||||||
footer = Template(params["mako"]["website"]['footer']).render(
|
footer = Template(params["mako"]["website"]['footer']).render(
|
||||||
|
@ -1,22 +1,39 @@
|
|||||||
import mysql.connector as mariadb
|
|
||||||
from mako.template import Template
|
from mako.template import Template
|
||||||
from config import globalvar, database
|
from config import globalvar
|
||||||
|
from bottle import request
|
||||||
|
|
||||||
|
import procedure.session as procedure_session
|
||||||
|
|
||||||
class notme:
|
class notme:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.db_main = mariadb.connect(**database.db_main)
|
self.user = {
|
||||||
self.cursor = self.db_main.cursor(dictionary=True)
|
"data":{
|
||||||
self.user_roles = [0] # Cari user roles disini
|
"profile":{
|
||||||
|
"username":None,
|
||||||
|
"email":None,
|
||||||
|
"phone":None,
|
||||||
|
"roles":[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def html(self, params):
|
def html(self, params):
|
||||||
active_page = None
|
active_page = None
|
||||||
|
allowed_roles = [0,1,2,3]
|
||||||
|
beaker_session = request.environ.get('beaker.session')
|
||||||
|
jwt = beaker_session["token"] if "token" in beaker_session else None
|
||||||
|
self.user = procedure_session.session().user(jwt, allowed_roles) if jwt is not None else self.user
|
||||||
|
user = self.user['data']
|
||||||
|
if 'valid' in user and user['valid']['status'] == 0:
|
||||||
|
return redirect('/logout')
|
||||||
|
else:
|
||||||
return Template(params["mako"]["website"]['index']).render(
|
return Template(params["mako"]["website"]['index']).render(
|
||||||
title = globalvar.title,
|
title = globalvar.title,
|
||||||
header = globalvar.header,
|
header = globalvar.header,
|
||||||
navbar = Template(params["mako"]["website"]['navbar']).render(
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
||||||
menu = globalvar.menu['public']['navbar'],
|
menu = globalvar.menu['public']['navbar'],
|
||||||
user_roles = self.user_roles,
|
user_roles = user['profile']['roles'],
|
||||||
active_page = active_page
|
active_page = active_page
|
||||||
),
|
),
|
||||||
footer = Template(params["mako"]["website"]['footer']).render(
|
footer = Template(params["mako"]["website"]['footer']).render(
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
import mysql.connector as mariadb
|
|
||||||
from mako.template import Template
|
from mako.template import Template
|
||||||
from config import globalvar, database
|
from config import globalvar
|
||||||
|
from bottle import request
|
||||||
|
|
||||||
class register:
|
class register:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.db_main = mariadb.connect(**database.db_main)
|
pass
|
||||||
self.cursor = self.db_main.cursor(dictionary=True)
|
|
||||||
self.user_roles = [0] # Cari user roles disini
|
|
||||||
|
|
||||||
def html(self, params):
|
def html(self, params):
|
||||||
|
|
||||||
roles = params["roles"]
|
roles = params["roles"]
|
||||||
active_page = "Register"
|
active_page = "Register"
|
||||||
|
user_roles = [0]
|
||||||
|
beaker_session = request.environ.get('beaker.session')
|
||||||
|
jwt = beaker_session["token"] if "token" in beaker_session else None
|
||||||
|
if jwt is not None:
|
||||||
|
return redirect('/')
|
||||||
|
else:
|
||||||
return Template(params["mako"]["website"]['index']).render(
|
return Template(params["mako"]["website"]['index']).render(
|
||||||
title = globalvar.title,
|
title = globalvar.title,
|
||||||
header = globalvar.header,
|
header = globalvar.header,
|
||||||
navbar = Template(params["mako"]["website"]['navbar']).render(
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
||||||
menu = globalvar.menu['public']['navbar'],
|
menu = globalvar.menu['public']['navbar'],
|
||||||
user_roles = self.user_roles,
|
user_roles = user_roles,
|
||||||
active_page = active_page
|
active_page = active_page
|
||||||
),
|
),
|
||||||
footer = Template(params["mako"]["website"]['footer']).render(
|
footer = Template(params["mako"]["website"]['footer']).render(
|
||||||
|
@ -1,22 +1,39 @@
|
|||||||
import mysql.connector as mariadb
|
|
||||||
from mako.template import Template
|
from mako.template import Template
|
||||||
from config import globalvar, database
|
from config import globalvar
|
||||||
|
from bottle import request
|
||||||
|
|
||||||
|
import procedure.session as procedure_session
|
||||||
|
|
||||||
class verify:
|
class verify:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.db_main = mariadb.connect(**database.db_main)
|
self.user = {
|
||||||
self.cursor = self.db_main.cursor(dictionary=True)
|
"data":{
|
||||||
self.user_roles = [0] # Cari user roles disini
|
"profile":{
|
||||||
|
"username":None,
|
||||||
|
"email":None,
|
||||||
|
"phone":None,
|
||||||
|
"roles":[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def html(self, params):
|
def html(self, params):
|
||||||
active_page = None
|
active_page = None
|
||||||
|
allowed_roles = [0,1,2,3]
|
||||||
|
beaker_session = request.environ.get('beaker.session')
|
||||||
|
jwt = beaker_session["token"] if "token" in beaker_session else None
|
||||||
|
self.user = procedure_session.session().user(jwt, allowed_roles) if jwt is not None else self.user
|
||||||
|
user = self.user['data']
|
||||||
|
if 'valid' in user and user['valid']['status'] == 0:
|
||||||
|
return redirect('/logout')
|
||||||
|
else:
|
||||||
return Template(params["mako"]["website"]['index']).render(
|
return Template(params["mako"]["website"]['index']).render(
|
||||||
title = globalvar.title,
|
title = globalvar.title,
|
||||||
header = globalvar.header,
|
header = globalvar.header,
|
||||||
navbar = Template(params["mako"]["website"]['navbar']).render(
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
||||||
menu = globalvar.menu['public']['navbar'],
|
menu = globalvar.menu['public']['navbar'],
|
||||||
user_roles = self.user_roles,
|
user_roles = user['profile']['roles'],
|
||||||
active_page = active_page
|
active_page = active_page
|
||||||
),
|
),
|
||||||
footer = Template(params["mako"]["website"]['footer']).render(
|
footer = Template(params["mako"]["website"]['footer']).render(
|
||||||
|
Loading…
Reference in New Issue
Block a user