Inheritance diagram for PasswordField:
// Use the PHP builtin md5 $field = new PasswordField('passwd', array('encCallback' => 'md5'));
You can also define your own functions for this use too:
function weakCrypt($val, &$noQuote) { $noQuote = false; return ucfirst($val); } $field = new PasswordField('passwd', array('encCallback' => 'weakCrypt'));
The rules for the callback function are as follows:
The encCallback is especially useful if you want to use some sort of built in encryption in your database server. This example uses the MySQL built in AES_ENCRYPT function.
function strongCrypt($val, &$noQuote) { $noQuote = true; return "AES_ENCRYPT('$val', 'TopS3cr3t')"; }
Definition at line 48 of file password-field.inc.php.
Public Member Functions | |
drawInput () | |
Draw the field. | |
getData () | |
Get the field data, run through the encCallback method if defined. | |
getSqlImpl () | |
Get field data as an SQL string ready for use in a query. | |
Protected Member Functions | |
doEncCallback (&$noQuote) | |
If an encryption callback function has been defined, call it on the data. | |
Protected Attributes | |
$encCallback | |
Name of callback function to use to encrypt the password. |
|
If an encryption callback function has been defined, call it on the data.
Definition at line 93 of file password-field.inc.php. Referenced by getData(), and getSqlImpl(). |
|
Draw the field.
Reimplemented from TextField. Definition at line 55 of file password-field.inc.php. References AbstractField::extrasAsAttributes(). |
|
Get the field data, run through the encCallback method if defined.
Reimplemented from AbstractField. Definition at line 72 of file password-field.inc.php. References doEncCallback(). |
|
Get field data as an SQL string ready for use in a query.
Reimplemented from AbstractField. Definition at line 81 of file password-field.inc.php. References doEncCallback(). |
|
Name of callback function to use to encrypt the password.
Definition at line 50 of file password-field.inc.php. |