Home AMX User Forum AMXForums Archive Threads Tips and Tricks

Password protecting certain touch panel pages

I have certain settings touch panel pages for which i want to give access control.

Now each panel comes with four passwords, how do i put a keypad to point to any one of them so that when i click on a button, the keypad pop ups and the password entered will be one of the four passwords. This way if the client wants to change the password in the future, he can change and the programming doesnt have to be modified.

Comments

  • ericmedleyericmedley Posts: 4,177
    John Paul wrote: »
    I have certain settings touch panel pages for which i want to give access control.

    Now each panel comes with four passwords, how do i put a keypad to point to any one of them so that when i click on a button, the keypad pop ups and the password entered will be one of the four passwords. This way if the client wants to change the password in the future, he can change and the programming doesnt have to be modified.

    If you're doing your panel page/popup navigation from code, this is not a problem.

    Make your own keypad, check the password, send the command. Pretty simple.
  • I agree with Eric, except I cheat and use the system keypad and compare the string response with my saved passwords. You can add a routine in there to allow the user to change passwords too.

    If you don't want to do the whole page navigation in code, you can do a manual/passive page flip on the TP to pop up your password page then have your code process the password and navigate to the destination page.

    In my experience though, password protections are a pain for the end user. 90% of the time they think they need it, then they end up asking me to just remove them.


    --John
  • ericmedleyericmedley Posts: 4,177
    I agree with Eric, except I cheat and use the system keypad and compare the string response with my saved passwords. You can add a routine in there to allow the user to change passwords too.

    If you don't want to do the whole page navigation in code, you can do a manual/passive page flip on the TP to pop up your password page then have your code process the password and navigate to the destination page.

    In my experience though, password protections are a pain for the end user. 90% of the time they think they need it, then they end up asking me to just remove them.


    --John


    I can also attest to the password being a pain in the 'p'*** for the client. I have yet to have a client ask for one and later ask for it to be removed. It's happened every time. This is a drag if you try to come up with some trick password schema and actually spend the time figuring it out.
  • John PaulJohn Paul Posts: 143
    Saved password?

    Thanks Guys for giving me the tips but i am thinking i dont want to use my saved passwords but each panel has its own four passwords which can be changed right? So the client has option to change password and i just ve to call the system keypad and then just check if the passwords are matching.Any idea on implementing this feature
  • DHawthorneDHawthorne Posts: 4,584
    There are send_commands to change the panel passwords ... you should be able to find them in PI. I'd look it up, but I'm in the middle of migrating to a new computer, and haven't got NS up and running yet (Web Update really takes a long time to update everything in one shot :) ).
  • ericmedleyericmedley Posts: 4,177
    Here's a basic idea. (presented very basically...)
    You can do this a lot slicker, but we'll keep it easy to illustrate the point.

    DEFINE_DEVICE
    
    dv_Pass_TP_01  = 10001:01:0
    dv_Pass_TP_02  = 10002:01:0
    dv_Pass_TP_03  = 10003:01:0
    dv_Pass_TP_04  = 10004:01:0
    
    DEFINE_VARIABLE
    
    persistent User_Passwords[4][4][10] // 4 TPs  X 4 Passwords X 10 chars each password
    volatile integer User_Pass_Flag[4] // a user is trying to enter a password. X 4 TPs
    volatile integer User_Pass_TP_ID[4] // a user is trying to enter a password. X 4 TPs
    volatile dev Pass_TPs[]=
    {
    dv_Pass_TP_01
    ,dv_Pass_TP_02
    ,dv_Pass_TP_03
    ,dv_Pass_TP_04
    }
    
    

    So, let's say we setup buttons 101,102,103,104 to be the "call up the keypad so a user can enter one of their passwords" on the access page. When they hit one of those buttons we call up the keypad and set the flag for which touch panel they're at. I'lll use a button stack but I'd normally use an array.
    BUTTON_EVENT[Pass_TPs,101] // enter protected page 1
    BUTTON_EVENT[Pass_TPs,102] // enter protected page 2
    BUTTON_EVENT[Pass_TPs,103] // enter protected page 3
    BUTTON_EVENT[Pass_TPs,104] // enter protected page 4
    {
    push:
      {
      stack_var integer tp_id
      tp_id=get_last(Pass_TPs)
      // command to call up keypad or keyboard
      User_Pass_Flag[tp_id]=1
      User_Pass_TP_ID[tp_id]=button.input.channel-100 // which page they want
      }
    }
    
    

    Okay, so now we know what they're trying to do. Once they hit done on the keypad we get the password from their entry.
    DATA_EVENT[Pass_TPs]
    {
    STRING:
      {
      stack_var integer tp_id
      stack_var pass_buff[15]
      stack_var junk[1]
      tp_id=get_last(Pass_TPs)
      if(find_string(data.text,'KEYP-',1) and User_Pass_Flag[tp_id]=1) // here comes a password
        {
        pass_buff=data.text
        junk=remove_string(pass_buff,'KEYP-',1)
        if(pass_buff==User_Passwords[tp_id][User_Pass_TP_ID[tp_id]])
          {
          // send the command to let them in
          }
        else
          {
          // no page flip for YOU!  Let them know that they have failed.
          }
        // Then do more 'IF' statements for password 2,3,4  (here again, I'd do it another way, but you get the gist of it.)
        User_Pass_Flag[tp_id]=0  // reset the flag
        }
      }
    }
    
    
    ]


    This crude example allows for 4 passwords per touch panel and each touch panel has it's own set of passwords. You can create another page/popup for the user to enter in thier passwords.

    that's one way to do it.
  • John PaulJohn Paul Posts: 143
    Passwords

    Ppl,

    I dont want to store a bunch of passwords in the code, .i want to check if the password fed is the same as the one in the protected settings of the panel

    If you are under the protected settings of any panel, you have an option under 'other settings' to go to 'cache' and 'password' 's page. Under 'Passwords', you have option to change the four passwords and user access.

    Now when i get a keypad press after the user feeds the passwords, it has to check with the password list under the panel and see if its one of them.
  • ericmedleyericmedley Posts: 4,177
    John Paul wrote: »
    Ppl,

    I dont want to store a bunch of passwords in the code, .i want to check if the password fed is the same as the one in the protected settings of the panel

    If you are under the protected settings of any panel, you have an option under 'other settings' to go to 'cache' and 'password' 's page. Under 'Passwords', you have option to change the four passwords and user access.

    Now when i get a keypad press after the user feeds the passwords, it has to check with the password list under the panel and see if its one of them.

    You probably don't have an option. There are commands that can set the passwords, but none that get them from the panel.

    you can write code that will take whatever the user types in and send it to the panel to change the passwords but not check against what's already there. So, the problem is that there still needs to be some kind of main user password that you set otherwise anyone will be able to go in and change passwords.

    The doing it form code option gives you much more control and ability. But, there are many threads on this forum arguing the 'run the panel from code' vs. 'run the panel from the panel' debate. I do not wish to further contribute to the argument.
  • viningvining Posts: 4,368
    1st if you want to do this with out code and allow the user the ability to change passwords you'll have to give them access to protected setup where if they start to roam and push buttons they can break your panel.

    I've only ever used the TPs passwords to allow a user to undock a panel but as far as restricting access to pages I'm not sure how possible that may be. There is a command in PI for password page flip which might just work if you let the display time out and go to a splash page where you have to touch a button to go to the main page which you've already set up with the password page flip command.

    To many unknowns for my brain to process so I'd opt to handle it in code where I know what's going on. Then you can do other stuff like allow full access when the homeowners are there whhich you can determine via the security system being diarmed with their code.
  • John PaulJohn Paul Posts: 143
    Thanks

    Thanks Eric,

    I get your point. The client over here is in the AV field and he knows about touch panels. Now he just wants to restrict access to the house cleaning staff, these pages in the panels.

    Now but like you said its easier to feed our own passwords
  • DHawthorneDHawthorne Posts: 4,584
    The send_command is ^PWD-<password # 1-4>,<new password> .

    I take a hybrid approach - yes, it's one way, you can't extract it, but if you always set it from code, your code can store what you set in a persistent variable. I had the exact situation as the original poster, and whipped up a module for the homeowner to change his panel passwords himself ... it did every panel in the house at one time, so it really made life a lot easier. It's also far easier to set the panel password than to parse your own and pass/fail it.
  • It's easy enough to write a routine to allow the user to select and change his own passwords. As a matter of fact even if you could query the panel's stored passwords, it's easier to handle it all in code since the passwords only have to be entered/changed once at any touchpanel and it will be valid for all panels as opposed to having to go to every touchpanel in the house and entering the passwords onto each panel. Think also along the lines that the client forgets his password and you have to reset them for him.

    Some direction on this would be to have a "change password" page and have the user enter the existing password and then the desired password. Compare the entered password against the stored password and if it's correct then change the password to the second entry:
    IF(cEnteredPassword == cStoredPassword)
    {
      cStoredPassword = cNewPassword
    }
    ELSE
    {
      //Indicate that the entered password is incorrect
    }
    

    This could be expanded to multiple users each with their own passwords, level of access, panels that they're allowed to access, etc...

    --John
  • oops, I didn't see Dave's post before I submitted. His method deals with having to enter the password on multiple panels. If I'm storing passwords though, I'd still just place them in code and not bother to send them to the panels. I don't like end users messing around in setup. "Experienced" end users are the worst :).

    --John
  • John PaulJohn Paul Posts: 143
    Experienced End users

    I second your thoughts on the experienced end users, they make my life a hell with their modifications
  • ericmedleyericmedley Posts: 4,177
    John Paul wrote: »
    I second your thoughts on the experienced end users, they make my life a hell with their modifications

    Or they start their own comapnys. (Savant) Perhaps that's why I get annoyed every time I talk to their CEO.
  • samossamos Posts: 106
    here is a idea

    I can explain a way to do it. Go to the button properties of the button you want to flip to the protected page. Look for the password protected property and select password protected to password1,or 2 etc...

    In the data event for the touch panel. track the page flips in the panel. your logic would have to say if the security keypad pops up and the the next page to show up after that is the 'Secret page' the password was typed correctly

    If you want the end user to change the passwords without going into protected setup

    1. In tp4 select file open system page template. Find the buttons for changing the password and copy and paste it into your page.
  • John PaulJohn Paul Posts: 143
    Thanks

    Finally got the answer i wanted .
Sign In or Register to comment.