Force username login always being lowercase

This commit is contained in:
emanuele-f 2017-05-29 11:39:19 +02:00
parent d3debf04ef
commit ac07c48b7c
7 changed files with 33 additions and 12 deletions

View file

@ -9,15 +9,15 @@ require "lua_utils"
sendHTTPHeader('application/json')
if(haveAdminPrivileges()) then
key = "ntopng.user.".. _GET["username"] ..".password"
key = "ntopng.user.".. string.lower(_GET["username"]) ..".password"
existing = ntop.getCache(key)
if(string.len(existing) > 0) then
print('{ "valid" : 0, "user": "'.. _GET["username"]..'", "msg": "User already existing" }\n')
print('{ "valid" : 0, "user": "'.. string.lower(_GET["username"])..'", "msg": "User already existing" }\n')
return
else
valid = 1
end
print('{ "valid" : 1, "user": "'.. _GET["username"]..'", "msg": "Ok" }\n')
print('{ "valid" : 1, "user": "'.. string.lower(_GET["username"])..'", "msg": "Ok" }\n')
end