def user_page(user_id): userId = user_id print(userId) userInfo = model.getUserInfo(userId) if userInfo is None: print("userId is None...") redirect("/start?user=failed") else: inList = model.getInputData(userId) inputList = [] for inData in inList: inputList.append({ "id": inData[0], "inText": inData[1], "createDate": inData[2] }) outList = model.getOutputData(userId) outputList = [] for outData in outList: outputList.append({ "id": outData[0], "outText": outData[1], "createDate": outData[2] }) return template("userpage.html", userId=userInfo[0][0], inputList=inputList, outputList=outputList)
def user_create(): print("NAK::user create in") userId = request.forms.userId print(userId) retVal = model.getUserInfo(userId) if retVal is None: redirect("/start?user=failed") else: redirect("/user/" + urllib.parse.quote(userId))
def userRegistration(): print(view.printTitle("Registration")) username = input(view.queryString("username")) if not model.getUserInfo(username) == []: print(view.invalidString("username","registration menu")) userRegistration() else: password = input(view.queryString("password")) model.registerUser(username,password) print(view.printRoute(f"Registered {username} with password {password}.","main menu")) app()
def POST(self): f = self.loginForm() f.validates() userInfo = {} if int(f["sqlInject"].value) == 1: userInfo = model.getUserInfo(f["username"].value, f["password"].value) elif int(f["sqlInject"].value) == 0: userInfo = model.getUserInfoSec(f["username"].value, f["password"].value) if not userInfo: return render.error() else: return render.info(userInfo)
def userLogin(): username = input(view.queryString("username")) password = input(view.queryString("password")) user_info = model.getUserInfo(username) if not user_info == []: if user_info[0]['password'] == password: print(view.validString("Credentials","User Menu")) return user_info[0] else: print(view.invalidString("Credentials","Main Menu")) app() else: print(view.invalidString("Credentials","Main Menu")) app()
def user_conf(): token = request.get_cookie(cookie_key) if token is not None: uid = request.get_cookie('uid') u_info = model.getUserInfo(uid) name = u_info[0][2] permit = u_info[0][4] print(u_info) return template('user', name=name, UID=uid, Permission=permit, doc_root=document_root) else: return redirect('{}/login'.format(document_root))
def userRegisteration(): print(view.printTitle("Registration")) username=input(view.queryString("username")) if not model.getUserInfo("username","registration menu") )