Index  Up  <<  >>  


Setting defaults with the UserDB directive

The UserDB directive provides a way to set defaults for the user database. For example, if you always wanted to save and recall the scratch variable tickets in the user database instead of the form variable tickets, you could set:

    UserDB   default   scratch  tickets

That makes every call to [userdb function=login] be equivalent to [userdb function=login scratch=tickets].

If you wish to override that default for one call only, you can use [userdb function=login scratch="passes"].

The UserDB directive uses the same key-value pair settings as the Locale and Route directives, and you may have more than one set of defaults. You can set them in a hash structure:

        UserDB  crypt_case  <<EOF
        {
                'scratch'                => 'tickets',
                'crypt'                  => '1',
                'ignore_case'    => '0',
        }
        EOF

        UserDB  default  <<EOF
        {
                'scratch'                => 'tickets',
                'crypt'                  => '1',
                'ignore_case'    => '1',
        }
        EOF

NOTE: The usual here-document caveats apply -- the EOF must be on a line by itself with no leading/trailing whitespace.

The last one to be set becomes the default.

The option profile selects the set to use. So if you wanted usernames and passwords to be case sensitive with no encryption, you could pass this call:

        [userdb function=new_account profile=case_crypt]

The username and password will be stored as typed in, and the password will be encrypted in the database.


Index  Up  <<  >>