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"].

If you wish 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, 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  <<  >>