Yesterday, 14:24
Hi all,
Even if this is related to my previous post, I prefer to create a new topic to facilitate the search for the next one :-)
I have a lp file so that users can change their own password
this is my code :
Everythin work, but after the page change, the user has to reconnect, I'd like to avoid this, I saw that an x-auth cookie was added, I tried to find the hash value, but I can't
I've tried a base 64 like user:password or user:hash_password...
Thanks for the help
Even if this is related to my previous post, I prefer to create a new topic to facilitate the search for the next one :-)
I have a lp file so that users can change their own password
this is my code :
Code:
if getvar("form-name") == "password" then
local login = getvar('login')
local current_logged_user = request.username
if username ~= "admin" and login ~= current_logged_user then
return nil, 'wrong_user'
end
local password = getvar('user-new-password')
local password_confirmation = getvar("user-new-password-confirmation")
local user = db:getrow('SELECT * FROM users WHERE login=?', login)
if not user then
return nil, 'user_not_found'
end
if password ~= password_confirmation then
return nil, 'match'
end
if #password < 8 or #password > 20 then
return nil, 'length'
end
local password = hashpassword(login, password)
db:update('users', { password = password }, { id = user.id })
io.readproc('/etc/init.d/nginx reload')
return true, nil, string.format("%s:%s", login, password)
end
Everythin work, but after the page change, the user has to reconnect, I'd like to avoid this, I saw that an x-auth cookie was added, I tried to find the hash value, but I can't
I've tried a base 64 like user:password or user:hash_password...
Thanks for the help