From Dwayne Wright PMP
Certified FileMaker Developer
Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here).
This was a pre FileMaker 7 example I created and is a neat little example file ( if I say so myself ) that uses the Show Custom Dialog box script step to check and see if a user has the secondary password to perform an operation. Call it a double secret authentication for a user, if you will.
ABOUT THE SHOW CUSTOM DIALOG BOX SCRIPT STEP
The Show Custom Dialog box script step has features such as ...
- the ability to show a customized title and message
- the ability to add data into three possible fields
- the ability to include three buttons that branch a script accordingly.
Other features include the ability to use literal text or a calculation to show the dialog box title, the dialog box main message and the labels for the input fields. The fields that you use for data entry do not have to be on the current layout and field validation you have setup for the selected fields will still take place. The same is true for any access privilege settings you might have for those fields, although those settings can be overridden using that check box option in the script itself. If you use global fields for data entry in the Custom Dialog Box, you might want to clear them of data at the start or end of the script. Otherwise, they may contain the data the user had included in a previous execution of this script in the same session.
BACK TO OUR EXAMPLE
I made sure the password is in the exact same case. That is to say the script will know the difference between upper and lower case letters. Also, it has the ability to detect that you entered in the password correctly ... but your caps lock key is on ... making the password in all upper case ... making the password fail.
The file itself is very simple, we have a button called Test Custom Dialog Password. We also show you the actual password ( normally you wouldn’t do this ). We setup the default password to be FileMaker. Click the button and type FileMaker in and see the ok message. Now do the same with the Cap Lock key on and see the error message. No do the same but type in something other than FileMaker and see the error message.
Our script is a three layered branching statement. First it looks to see if the text entered into the custom dialog is an exact match by using the Exact text function. If they are the same, FileMaker approves the password and the script is done.
If the entered data and password are NOT a match, then we check to see if the passwords are equal and the Caps Lock key is on. We can detect the use of the CAPS LOCK key by using the Get(ActiveModifierKeys) function. We can then hint to the user that the Caps Lock key might be the problem. This could be something you did not want to do, depending on how you have setup the security of your databases. I’m just showing you the technique of what can be done.
Last but not least ... if the other two tests are not TRUE, we know the user has an incorrect password.
An example file can be downloaded by clicking (here)
More info about the author and FileMaker in general, contact me at email@example.com.
© 2008 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.