The default action taken by GiD when validating a problem type password is verifying that it is not empty. When a password is considered as valid, this information is written in the file 'password.txt' which is located in the problem type directory. In order to override this behaviour, two nodes are provided in the .xml file
- PasswordPath: The value of this node specifies a relative or absolute path describing where to locate/create the file password.txt. If the value is a relative path it is taken with respect to the problem type path.
Example:
<PasswordPath>..</PasswordPath>
- ValidatePassword: The value of this node is a Tcl script which will be executed when a password for this problem type needs to be validated. The script receives the parameters for validation in the following variables:
key with the contents of the password typed,
dir with the path of the problem type, and
computer_name with the name of host machine.
Note: It's like this Tcl procedure prototype: proc PasswordPath { key dir computer_name } { ... body... }
The script should return one of three possible codes:
0 in case of failure.
1 in case of success.
2 in case of success; the difference here is that the problem type has just saved the password information so GiD should not do it.
Furthermore, we can provide a description of the status returned for GiD to show to the user. If another status is returned, it is assumed to be 1 by default.
Below is an example of a <ValidatePassword> node.