From fab9eb483758d94dcbbc186b56d73e3fddeb0551 Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Sat, 7 Aug 2021 13:49:23 +0600 Subject: [PATCH] v5.2.3.0 Changelog: https://haproxy-wi.org/changelog.py#5_2_3 --- api/api_funct.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/api_funct.py b/api/api_funct.py index d881a72..b2c1117 100644 --- a/api/api_funct.py +++ b/api/api_funct.py @@ -1,9 +1,9 @@ import os import sys import json +from bottle import route, run, template, hook, response, request, post sys.path.append(os.path.join(sys.path[0], '/var/www/haproxy-wi/app/')) -from bottle import route, run, template, hook, response, request, post import sql import funct @@ -22,18 +22,18 @@ def get_token(): except Exception as e: return 'error getting group: '+str(e) try: - users = sql.select_users(username=login) + users = sql.select_users(user=login) password = funct.get_hash(password_from_user) except Exception as e: - return str(e) + return 'error one more: '+str(e) for user in users: - if user[7] == 0: + if user.activeuser == 0: return False - if login in user[1] and password == user[3]: + if login in user.username and password == user.password: import uuid user_token = str(uuid.uuid4()) - sql.write_api_token(user_token, group_id, user[4], user[1]) + sql.write_api_token(user_token, group_id, user.role, user.username) return user_token else: return False