mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-03-09 15:40:05 +00:00
Fix check userid
This commit is contained in:
parent
351927eec9
commit
3d0f65ea3b
1 changed files with 2 additions and 2 deletions
|
@ -144,7 +144,7 @@ def get_username_from_userid(userid):
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return {'error': 'Config file not readable', 'route': 'get_username'}
|
return {'error': 'Config file not readable', 'route': 'get_username'}
|
||||||
for user in data['users'][0]:
|
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 user
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ def check_username_serial(username, serial):
|
||||||
if 'serial_error' not in data['users'][0][username]:
|
if 'serial_error' not in data['users'][0][username]:
|
||||||
data['users'][0][username]['serial_error'] = 0
|
data['users'][0][username]['serial_error'] = 0
|
||||||
else:
|
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:
|
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json', 'w') as outfile:
|
||||||
json.dump(data, outfile, indent=4)
|
json.dump(data, outfile, indent=4)
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue