![]() |
|
Password Script and touch - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Password Script and touch (/showthread.php?tid=5863) |
Password Script and touch - oki - 28.01.2025 Hi, I'm trying to make a script that allows users of the LogicMachine to change their password. The problem is that it deactivates the touch associated with each user and I need each one to see their screen. Any clues? Thank you in advance Code: require('apps')
require('json')
require('socket.http')
require('socket.url')
continua = true
i = 1
users = db:getall('SELECT id, login FROM users')
nombre = event.getvalue()
while users[i] ~= nil and continua == true do
name = users[i].login
if name == nombre then
ide = users[i].id
j=i
continua = false
end
i = i+1
end
acl = {
vis ={}, -- Table with the pages to which the user has access
schedulers = {},
trends = {}
}
log (users[j])
log (ide,j,nombre)
log('log',users[j])
pass= 'Passw123'
data = {
id = ide,
name = nombre, -- full name
login = nombre, -- login
password = pass, -- password
password_repeat = pass, -- must match password
active = true,
--access_vis = 'P', -- partial access to visualization
--access_schedulers = '', -- no access to schedulers
-- access_trends = 'P', --F', -- full access to trends
acces_apps ='P',
acces_touch ='F',
allow_objects = "",
homepage = "apps-touch",
acl = json.encode(acl)
}
post = 'data=' .. socket.url.escape(json.encode(data))
res, err = socket.http.request('http://admin:Password1@127.0.0.1/scada-main/users/save', post)
log(res, err, pass)RE: Password Script and touch - admin - 28.01.2025 Use webrequest library: https://forum.logicmachine.net/showthread.php?tid=4425 Some of the configuration fields are spelled incorrectly (acces_apps/acces_touch) and you set partial access without ACL. Use browser dev tools (F12) to check which fields/values are sent from the admin UI. RE: Password Script and touch - oki - 29.01.2025 Hi again, I have fixed the errors that you had told me and applied the changes and it has worked perfectly. Thank you so much
|