11 Replies Latest reply on Mar 1, 2010 11:20 AM by philmodjunk

    password protect a script

    dekade1

      Title

      password protect a script

      Post

      Have any of you ever password protected the operation of a script? I want to set up a method by which you have to type in a password in order to perform a particular script. I also do not want the characters you type in to be visible. In order words each character of the password that you type in would be replaced by x's or dashes or etc.

       

      Thanks for your time and I would really appreciate your help if anyone knows how.

        • 1. Re: password protect a script
          raybaudi
            

          Hi dekade

           

          A way to do this is:

           

          1) create a global text field ( PWDs ) where you'll write a list of accepted pwds
          2) create a global text field ( PWD )

           

          The script will be along this way:

           

          Show Custom Dialog [ "PWD" ; "This action needs a pwd" ; Input field: PWD ; Use password character ]
          If [ ValueCount ( FilterValues ( PWD ; PWDs ) ) ]
          --- go on with your script
          Else
          Show Custom Dialog [ "PWD" ; "This pwd is wrong" ]
          End If
          Set field [ PWD ; "" ]


          • 2. Re: password protect a script
            dekade1
              

            Thanks raybaudi. I appreciate your reply. Have you provided the actual script that I should use. I know beggars can't be choosy but could you break down the script and tell me what is taking place? I'm an advanced beginner, maybe not even that good, and sometimes I don't really understand all the filemaker nomenclature. No problem if you don't want to break it down. Just thought I'd ask. I appreciate what you have done so far.

             

            Dekade

            • 3. Re: password protect a script
              raybaudi
                

              Hi dekade

               

              1) Show Custom Dialog [ "PWD" ; "This action needs a pwd" ; Input field: PWD ; Use password character ]
              2) If [ ValueCount ( FilterValues ( PWD ; PWDs ) ) ]
              3) --- go on with your script
              4) Else
              5) Show Custom Dialog [ "PWD" ; "This pwd is wrong" ]
              6) End If
              7) Set field [ PWD ; "" ]

               

              which step gives you problems ?

               

              BTW:

              1) brings up a custom dialog which ask to enter the password

              2) verifies that the entered password is a good one from a list of good passwords

               

              I don't see any difficulties for the others.



              • 4. Re: password protect a script
                dekade1
                  

                I guess nothing is really confusing me. I was just trying to look at the script and have it pop out at me when and where I would see a field that shows maybe **** or xxxx for the password that one might type. I just am not experienced enough yet to look at various script steps or calculation formulas and visual what they are actually doing if it is the first time that I have used something new.

                 

                Once I see something work and then combine that visual with a description of a step or part of a calculation then I get a good grasp of everything. Sometimes I think I let FM psyche me out but as of yet I haven't found a way to let FM not be so intimidating to me on it's nomenclature. I really don't know how to describe it. I am pretty deep with some of the areas of FM that I do alot with but when I come across something new like 'value count' and 'filtervalues' I just get confused as to what they are doing.

                 

                I haven't actually plugged this into my script yet. So maybe when I do things will be clearer.

                 

                Thanks, and if you have any tips on my intimidation with FM let me know.

                • 5. Re: password protect a script
                  raybaudi
                    

                  dekade

                   

                  it's really difficult that FileMaker let you make something of distruptive ;)

                   

                  The "Show custom dialog" script step bring on a window with 2 tabs.

                   

                  Into the first one you can enter the Title, the Message and the text for 3 buttons ( you really need only one now, the OK button ).

                   

                  Into the second tab you can enter the name of an INPUT field ( actually you can enter 3 input fields ) and even spedify to use password character.

                   

                  So go and try ... you can make a working script even using only this step.

                  ----------------

                  The ValueCount ( FilterValues ( PWD ; PWDs ) ) part is a boolean calculation with a result of "true" IF the field PWD has a value that is in the PWDs Value list.


                  So, if the entered pwd is a good one, the script will go on, ELSE it will end.

                  • 6. Re: password protect a script
                    dekade1
                      

                    Thanks raybaudi. I am going to try this out sometime in the next 10 days. If I have a problem I would like to get back in touch with you. Thanks again for your help.

                    • 7. Re: password protect a script
                      Wayne1

                      Hiya,

                       

                      This is a nice little script, but it does not loop until a valid password is found.  It works the first time an incorrect password is entered, but on the second try, it allows access even without a valid password.

                       

                      I tried to put a loop into it, but I don't know where.  Can any body help please?  I have copied the original script below...

                       

                      1) create a global text field ( PWDs ) where you'll write a list of accepted pwds
                      2) create a global text field ( PWD )

                       

                      Show Custom Dialog [ "PWD" ; "This action needs a pwd" ; Input field: PWD ; Use password character ]
                      If [ ValueCount ( FilterValues ( PWD ; PWDs ) ) ]
                      --- go on with your script
                      Else
                      Show Custom Dialog [ "PWD" ; "This pwd is wrong" ]
                      End If
                      Set field [ PWD ; "" ]

                      Message Edited by raybaudi on 12-20-2008 06:18 PM


                      • 8. Re: password protect a script
                        mrvodka

                        This is not really secure. Why isnt the availability of a script being controlled by FileMaker's security using Accounts & Privileges?

                        • 9. Re: password protect a script
                          philmodjunk

                          To expand on Mr Vodka's suggestion:

                           

                          You can use Get ( PrivilegeSetName ) in an if step at the beginning of the script to determine whether a user has permission to run the script. Then you don't have to ask for a password each time the script is run to control who can use the script.

                           

                          Get ( AccountName ) can also work, but checking the privilege set name is usually easier to set up as you can test for groups of authorised users if they all have the same privilege set name.

                          • 10. Re: password protect a script
                            mrvodka

                            Thats not what I really meant. You can control what scripts can be executed within each Priv set setting itself.

                             

                            Why bother putting in some password scheme when only those who are part of that particular priv set can execute it?

                            • 11. Re: password protect a script
                              philmodjunk

                              Indeed,

                               

                              How silly of me!