This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Password Script and touch
#1
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)
Reply


Messages In This Thread
Password Script and touch - by oki - 28.01.2025, 08:24
RE: Password Script and touch - by admin - 28.01.2025, 08:33
RE: Password Script and touch - by oki - 29.01.2025, 14:04

Forum Jump: