8.2. Setting Defaults with the UserDB Directive

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

   UserDB   default   scratch  tickets

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

To override that default for one call only, use [userdb function=login scratch="passes"].

To log failed access authorizations, set the UserDB profile parameter log_failed true:

   UserDB  default  log_failed 1

To disable logging of failed access authorizations (the default), set the UserDB profile parameter log_failed to 0:

   UserDB  default  log_failed 0

The UserDB directive uses the same key-value pair settings as the Locale and Route directives. If there are more than one set of defaults, 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. For usernames and passwords to be case sensitive with no encryption, 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.