1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps-admin.git synced 2025-02-12 10:31:52 +00:00

Fix check userid

This commit is contained in:
Ycarus 2020-12-04 20:05:35 +01:00
parent 351927eec9
commit 3d0f65ea3b

View file

@ -144,7 +144,7 @@ def get_username_from_userid(userid):
except ValueError as e:
return {'error': 'Config file not readable', 'route': 'get_username'}
for user in data['users'][0]:
if 'userid' in data['users'][0][user] and data['users'][0][user]['userid'] == userid:
if 'userid' in data['users'][0][user] and int(data['users'][0][user]['userid']) == userid:
return user
return ''
@ -168,7 +168,7 @@ def check_username_serial(username, serial):
if 'serial_error' not in data['users'][0][username]:
data['users'][0][username]['serial_error'] = 0
else:
data['users'][0][username]['serial_error'] = data['users'][0][username]['serial_error'] + 1
data['users'][0][username]['serial_error'] = int(data['users'][0][username]['serial_error']) + 1
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json', 'w') as outfile:
json.dump(data, outfile, indent=4)
return False