mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Delete user sessions after password change
This commit is contained in:
parent
947026e842
commit
66f720787a
2 changed files with 16 additions and 5 deletions
|
|
@ -38,6 +38,16 @@ end
|
|||
|
||||
if(ntop.resetUserPassword(_SESSION["user"], username, old_password, new_password)) then
|
||||
print ("{ \"result\" : 0, \"message\" : \"Password changed successfully\" }")
|
||||
|
||||
-- Delete sessions for the current user
|
||||
local keys = ntop.getKeysCache("sessions.*")
|
||||
for k,_ in pairs(keys) do
|
||||
local v = ntop.getCache(k)
|
||||
|
||||
if(string.starts(v, username)) then
|
||||
ntop.delCache(k)
|
||||
end
|
||||
end
|
||||
else
|
||||
print ("{ \"result\" : -1, \"message\" : \"Unable to set the new user password: perhaps the old password was invalid ?\" }")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue