38 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
61 $label = str_replace(
"*",
"", $this->parent->prettifyFieldName($field));
62 $this->parent->match($field, $label,
"{$field}_confirm",
"Confirmation");
63 $this->parent->password($field, $label);
68 if (!$this->_includedPasswordScript)
71 <script type=
'text/javascript'>
73 function <?echo $this->parent->id?>_<?echo $field?>_showPassword()
75 var link = document.getElementById(
"<?echo $this->parent->id?>_<?echo $field?>_link");
76 var block = document.getElementById(
"<?echo $this->parent->id?>_<?echo $field?>_block");
77 document.id(
"<?echo $this->parent->id ?>_<?echo $field?>_reset_password").value = 1;
79 link.style.display =
"none";
80 block.style.display =
"block";
81 ModalDialog.recenterActiveDialog();
85 <? $this->_includedPasswordScript =
true;
91 $enter = $this->parent->passwordEnterLabel;
92 $confirm = $this->parent->passwordConfirmLabel;
93 $size = $this->numeric ?
"6" :
"20";
94 $onKeyPress = $this->numeric ?
" onkeypress='return maskInput(event, $allowneg);'" :
""
96 <table border=
"0" cellspacing=
"0" cellpadding=
"0" id=
"<?echo $this->parent->id ?>_<?echo $field?>_block" style=
"padding: 0px; display: <?echo $display ?>">
98 <td style=
"vertical-align: top; text-align: left"><?echo $enter?> </td>
99 <td style=
"padding-bottom: 2px"><input type=
"password" autocomplete=
"new-password" name=
"<?echo $field?>" id=
"<?echo $this->parent->id?>_<?echo $field?>" size=
"<?echo $size?>"<?echo $onKeyPress?> value=
""/></td>
102 <td style=
"vertical-align: top; text-align: left"><?echo $confirm?> </td>
103 <td><input type=
"password" name=
"<?echo $field?>_confirm" id=
"<?echo $this->parent->id?>_<?echo $field?>_confirm" size=
"<?echo $size?>"<?echo $onKeyPress?> value=
""/></td>
111 $pk = $this->parent->data->getPrimaryKey();
115 if (($this->parent->data->get($pk) && !$this->forceReset) || $this->allowEmpty)
117 $verb = ($this->allowEmpty && !$this->parent->data->get($pk)) ?
"set" :
"reset";
119 echo
"<a id='{$this->parent->id}_{$field}_link' href='#' onclick='{$this->parent->id}_{$field}_showPassword();return false;'>Click to {$verb} password</a>\n";
121 echo
"<input type='hidden' id='{$this->parent->id}_{$field}_reset_password' name='{$this->parent->id}_{$field}_reset_password' value=''/>\n";
126 echo
"<input type='hidden' id='{$this->parent->id}_{$field}_reset_password' name='{$this->parent->id}_{$field}_reset_password' value='1'/>\n";
137 echo
"<i>Password is hidden</i>\n";
144 $pk = $this->parent->data->getPrimaryKey();
146 if (!$this->parent->data->$pk || $_POST[
"{$this->parent->id}_{$field}_reset_password"])
148 $password = $_POST[$field];
152 if ($this->parent->data->getFilter() ==
null)
157 $filter = $this->parent->data->getFilter();
159 if ($filter->type ==
"ExclusionFilter")
161 $filter->add($field);
165 $filter->remove($field);
169 if ($this->allowEmpty && !$password)
171 $this->parent->data->set($field,
"");
175 $encryptor = $this->parent->passwordEncryptor;
177 trace(
"Encryptor: $encryptor", 3);
181 $password = $this->parent->data->$encryptor($password);
185 $password = crypt($password);
188 $this->parent->data->set($field, $password);
Used to place a filter on the contents of a DataItem-derived object.
FieldRenderer is the abstract base class for all FieldRenderers.
_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.
FieldRenderer($parent)
Constructor.
Field renderer for password data fields.
addValidatorsToForm($field, $required=false)
This method is called by the AutoForm to add any default input validators that are required by the Fi...
PasswordFieldRenderer(&$parent)
renderPasswordBlock($field, $display="block")
renderScript($field)
FieldRenderers can override this method to provide any Javascript that their control requires for an ...
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...
$forceReset
true if user logged in with a temporary token
trace($msg, $lvl=3, $callStack=null)
Send output to the trace log.