def POST(self, categor): file = web.input(avatar={}, background={}) file_dir = os.getcwd( ) + "/static/uploads/" + session_data['user']['username'] if not os.path.exists(file_dir): os.mkdir(file_dir) if "avatar" or "background" in file: filepath = file[categor].filename.replace("\\", "/") filename = filepath.split('/')[-1] f = open(file_dir + '/' + filename, "wb") f.write(file[categor].file.read()) f.close() update = {} update['type'] = categor update['img'] = '/static/uploads/' + session_data['user'][ 'username'] + '/' + filename update['username'] = session_data['user']['username'] account_model = LoginModel.LoginModel() update_img = account_model.update_image(update) raise web.seeother("/settings")
def GET(self, user): login = LoginModel.LoginModel() user_info = login.get_profile(user) post_model = Posts.Posts() posts = post_model.get_user_posts(user) return render.Profile(posts, user_info)
def GET(self): data = type('obj', (object,), {"username":"******", "password":"******"}) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data["user"] = isCorrect return render.Home()
def GET(self, user): login = LoginModel.LoginModel() user_info = login.get_profile(user) return render.Info(user_info)
def POST(self, type): file = web.input(avatar={}, background={}) file_dir = os.getcwd( ) + "/static/upload/" + session_data["user"]["username"] if not os.path.exists(file_dir): os.mkdir(file_dir) if "avatar" or "background" in file: filepath = file[type].filename.replace('\\', '/') filename = filepath.split("/")[-1] f = open(file_dir + "/" + filename, 'wb') f.write(file[type].file.read()) f.close() update = {} update["type"] = type update["img"] = '/static/uploads/' + session_data["user"][ "username"] + "/" + filename update["username"] = session_data["user"]["username"] account_model = LoginModel.LoginModel() update_avatar = account_model.update_image(update) raise web.seeother("/settings")
def POST(self, type): #image or bg file = web.input(avatar={}, background={}) file_dir = os.getcwd( ) + "/static/upload/" + session_data['user']['username'] if not os.path.exists(file_dir): os.mkdir(file_dir) if 'avatar' or 'background' in file: filepath = file[type].filename.replace("\\", "/") filename = filepath.split('/')[-1] f = open(file_dir + '/' + filename, 'wb') f.write(file[type].file.read()) f.close() update = {} update['type'] = type update['img'] = '/static/upload/' + session_data['user'][ 'username'] + '/' + filename update['username'] = session_data['user']['username'] account_model = LoginModel.LoginModel() update_avater = account_model.update_image(update) raise web.seeother('/settings') #redirect
def GET(self, user): login = LoginModel.LoginModel() user_info = login.get_profile(user) exper_model = Experience.Experience() expers = exper_model.get_all_expers() return render.profile(render2.info(user_info, expers))
def GET(self, user): login = LoginModel.LoginModel() user_info = login.get_profile(user) post_model = Posts.Posts() posts = post_model.get_all_posts() return render.profile(render2.fecth_post(posts, user_info))
def POST(self): data = web.input() login_model = LoginModel.LoginModel() response = login_model.check_user(data) if response != "error": session_data['user'] = response return response
def POST(self): data = web.input() login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data["user"] = isCorrect return isCorrect return "error"
def GET(self, user): login = LoginModel.LoginModel() if session_data['user'] is None: user_info = login.get_profile(None) else: user_info = login.get_profile(user) return render.Settings(user_info)
def GET(self): data = type('obj', ('object', ), { "username": "******", "password": "******" }) login = LoginModel.LoginModel() user_info = login.get_profile(user) return render.Info()
def POST(self): data = web.input() data.username = session_data['user']['username'] settings_model = LoginModel.LoginModel() if settings_model.update_info(data): return "success" else: return "a fatal error has occurred"
def POST(self): data = web.input() data.username = session_data["user"]["username"] settings_model = LoginModel.LoginModel() if settings_model.update_info(data): return "success" else: return "An error occurred"
def POST(self): data = web.input() data.username = session_data['user']['username'] settings_model = LoginModel.LoginModel() if settings_model.update_info(data): return "success" else: return "Could not update :("
def POST(self): print("DOING CHECK LOGIN") data = web.input() login = LoginModel.LoginModel() isValid = login.check_user(data) if isValid: session_data["user"] = isValid return isValid return "error"
def POST(self): data = web.input() data.username = session_data["user"]["username"] settings_model = LoginModel.LoginModel() if settings_model.update_info(data): return "success" else: return "Some unexpected error take place try again..."
def POST(self): data = web.input() data.username = session_data['user']['username'] settings_model = LoginModel.LoginModel() if settings_model.update_info(data): return 'success' else: return 'Fatal error'
def POST(self): data = web.input() login_model = LoginModel.LoginModel() isCorrect = login_model.check_user(data) if isCorrect: session_data['user'] = isCorrect return isCorrect return 'error'
def GET(self): data = type('obj', (object, ), { 'username': '******', 'password': '******' }) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data['user'] = isCorrect return render.Home()
def POST(self): res = web.data() data = json.loads(res) login = LoginModel.LoginModel() user = login.check_user(data) if user: session_data["user"] = user return user return 'error'
def GET(self): data = type('obj', (object, ), { "username": "******", 'password': '******' }) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data['user'] = isCorrect return render.Home()
def GET(self): post_model = Posts.Posts() posts = post_model.get_all_posts(None) if session_data['user']: login = LoginModel.LoginModel() user_info = login.get_profile(session_data['user']['username']) posts = post_model.get_all_posts(user_info['username']) return render.home(posts, user_info) else: return render.home(posts, None)
def POST(self): data = web.input() login = LoginModel.LoginModel() ans = login.check_user(data) if ans == "Incorrect Password" or ans == "User not registered": return ans else: session_data["user"] = ans # print(ans) # print(session_data["user"]) return ans
def GET(self): data = type('obj', (object,), {"username": "******", "password" : "jaiambe1234"}) print("Control passed to Home screen for :", data.username, " and" , data.password) login = LoginModel.LoginModel() isCorrect = login.check_user(data) print("Control passed to Home screen for 2 :", data.username, " and", data.password) post_model = Posts.Posts() posts = post_model.get_all_posts() return render.Home(posts)
def POST(self): data = web.input() print("Checking Login details: ", "Username is : ", data.username, "and password is : ", data.password) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: print ("User :"******" , matches and logged in") session_data["user"] = isCorrect return isCorrect return "error"
def GET(self): data = type('obj', (object,), {"username": "******", "password": "******"}) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data['user'] = isCorrect post_model = Posts.Posts(); posts = post_model.get_all_posts() return render.Home(posts)
def GET(self): data = type('obj', (object,), {"username" : "genius", "password" : "123"}) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data["user"] = isCorrect post_model = Posts.Posts() posts = post_model.get_all_posts() return render.Home(posts) # this will open the MainLayout.html with Home.html content
def GET(self, user): data = type('obj', (object, ), { "username": "******", "passworde": "dengo" }) login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data["user"] = isCorrect return render.Settings()
def GET(self, user): login = LoginModel.LoginModel() post_model = Posts.Posts() if user is None: user_info = login.get_profile(None) posts = post_model.get_user_posts(None) else: user_info = login.get_profile(user) posts = post_model.get_user_posts(user) print(render) return render.Profile(posts, user_info)