6 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
16 var
$errorMessage =
"Your signature does not match your password. Please try again.";
25 $this->password =
true;
26 $this->autocomplete =
false;
31 $label = isset($this->label) ? $this->label : $this->parent->prettifyFieldName($field);
33 $this->parent->validator->add(
new SignatureValidator($field, $label, $this->errorMessage, $this->signatureField));
53 if ($this->parent->msg)
56 $this->parent->data->set($field,
'');
59 if ($this->parent->data->get($field))
65 parent::renderField($field);
71 if (!$field) $field = $this->field;
72 $value = $this->parent->data->get($field);
73 list($signature,$date,$user_id) = explode(
":", $value);
79 $mgr =
new UserManager();
80 $u = $mgr->getUser($user_id);
81 $msg =
"Signed by ".$mgr->getUserFullName($u).
" on $date";
85 $msg =
"Invalid Signature";
104 if (!$_POST[$field])
return;
106 $obj = $this->parent->data;
107 if ($this->signatureField ==
"password")
109 $obj->set($field, $user->hashPassword($_POST[$field]).
":".
today().
":".$user->get($user->getPrimaryKey()));
113 $obj->set($field, $_POST[$field]).
":".
today().
":".$user->get($user->getPrimaryKey());
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
Provides a very simple digital signature implementation.
$signatureField
The field to check for a match when signing.
$autocomplete
Whether to allow autocomplete.
addValidatorsToForm($field, $required=false)
This method is called by the AutoForm to add any default input validators that are required by the Fi...
setSignatureField($signatureField, $errorMessage)
Overrides the default field used to match when signing.
$password
Whether to mask the input in the signature field.
preProcess($field="")
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the pa...
renderField($field="")
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
renderReadOnly($field="")
SignatureFieldRenderer(&$parent)
Validates that the user's supplied password is correct.
Field renderer for string data fields.
StringFieldRenderer(&$parent)
today()
Returns today as a string.