fixed storing same password twice in admin makes account unusable:

caused by tabs and callbacks added multiple times and therefor passwords beforeSendToClient method was called twice causing password to be replaced with asterisks
This commit is contained in:
Ralf Becker 2014-09-06 10:00:42 +00:00
parent bb569e6db8
commit 88a111b2c5
2 changed files with 21 additions and 9 deletions

View File

@ -2153,7 +2153,11 @@ window.egw_LAB.wait(function() {
$content['jpegphoto'] = !empty($content['jpegphoto']); // unused and messes up json encoding (not utf-8)
$this->tmpl->setElementAttribute('tabs', 'add_tabs', true);
$tabs =& $this->tmpl->getElementAttribute('tabs', 'tabs');
if (true) $tabs = array();
if (($first_call = !isset($tabs)))
{
$tabs = array();
}
//error_log(__LINE__.': '.__METHOD__."() first_call=$first_call");
$hook_data = $GLOBALS['egw']->hooks->process(array('location' => 'addressbook_edit')+$content);
//error_log(__METHOD__."() hook_data=".array2string($hook_data));
foreach($hook_data as $extra_tabs)
@ -2162,12 +2166,6 @@ window.egw_LAB.wait(function() {
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
{
$tabs[] = array(
'label' => $extra_tab['label'],
'template' => $extra_tab['name'],
'prepend' => $extra_tab['prepend'],
);
//error_log(__METHOD__."() changed tabs=".array2string($tabs));
if ($extra_tab['data'] && is_array($extra_tab['data']))
{
$content = array_merge($content, $extra_tab['data']);
@ -2180,6 +2178,9 @@ window.egw_LAB.wait(function() {
{
$readonlys = array_merge($readonlys, $extra_tab['readonlys']);
}
// we must NOT add tabs and callbacks more then once!
if (!$first_call) continue;
if (!empty($extra_tab['pre_save_callback']))
{
$preserve['pre_save_callbacks'][] = $extra_tab['pre_save_callback'];
@ -2188,6 +2189,15 @@ window.egw_LAB.wait(function() {
{
$preserve['post_save_callbacks'][] = $extra_tab['post_save_callback'];
}
if (!empty($extra_tab['label']) && !empty($extra_tab['name']))
{
$tabs[] = array(
'label' => $extra_tab['label'],
'template' => $extra_tab['name'],
'prepend' => $extra_tab['prepend'],
);
}
//error_log(__METHOD__."() changed tabs=".array2string($tabs));
}
}
return $this->tmpl->exec('addressbook.addressbook_ui.edit', $content, $sel_options, $readonlys, $preserve, 2);

View File

@ -41,8 +41,10 @@ class etemplate_widget_tabbox extends etemplate_widget
{
// Make sure additional tabs are processed for any method
if($this->attrs['tabs'])
if($this->attrs['tabs'] && !$this->tabs_attr_evaluated)
{
$this->tabs_attr_evaluated = true; // we must not evaluate tabs attribte more then once!
// add_tabs toggles replacing or adding to existing tabs
if(!$this->attrs['add_tabs'])
{
@ -95,7 +97,7 @@ class etemplate_widget_tabbox extends etemplate_widget
{
$value = self::get_array($content, $form_name);
$valid =& self::get_array($validated, $form_name, true);
if (true) $valid = $value;
if (true) $valid = $value;
}
}
}