Index: branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php =================================================================== diff -u -r6922 -r6923 --- branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6922) +++ branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6923) @@ -341,14 +341,19 @@ { $object =& $event->getObject(); - $sql = 'UPDATE '.TABLE_PREFIX.'UserGroup + $ug_table = TABLE_PREFIX.'UserGroup'; + if ($object->mode == 't') { + $ug_table = $this->Application->GetTempName($ug_table, 'prefix:'.$event->Prefix); + } + + $sql = 'UPDATE '.$ug_table.' SET PrimaryGroup = 0 WHERE PortalUserId = '.$object->GetDBField('PortalUserId'); $this->Conn->Query($sql); $group_id = $this->Application->ConfigValue('User_NewGroup'); - $sql = 'REPLACE INTO '.TABLE_PREFIX.'UserGroup(PortalUserId,GroupId,PrimaryGroup) VALUES (%s,%s,1)'; + $sql = 'REPLACE INTO '.$ug_table.'(PortalUserId,GroupId,PrimaryGroup) VALUES (%s,%s,1)'; $this->Conn->Query( sprintf($sql, $object->GetID(), $group_id) ); } } @@ -1049,20 +1054,29 @@ return false; } + // put salt to user's config + $field_options = $this->Application->getUnitOption($event->Prefix.'.RootPassword', 'Fields'); + $field_options['salt'] = 'b38'; + $this->Application->setUnitOption($event->Prefix.'.RootPassword', 'Fields', $field_options); + $object =& $event->getObject( Array('skip_autoload' => true) ); /* @var $object UsersItem */ $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if ($items_info) { list ($id, $field_values) = each($items_info); - $object->SetDefaultValues(); + $this->RemoveRequiredFields($object); $object->SetDBField('RootPassword', $this->Application->ConfigValue('RootPass')); - $object->Fields['RootPassword']['salt'] = 'b38'; - $object->SetFieldsFromHash($field_values); $status = $object->Validate(); if ($status) { // validation on, password match too + $fields_hash = Array ( + 'VariableValue' => $object->GetDBField('RootPassword') + ); + $conf_table = $this->Application->getUnitOption('conf', 'TableName'); + $this->Conn->doUpdate($fields_hash, $conf_table, 'VariableName = "RootPass"'); + $event->SetRedirectParam('opener', 'u'); } else { $event->status = erFAIL; Index: branches/unlabeled/unlabeled-1.2.8/core/kernel/utility/formatters/password_formatter.php =================================================================== diff -u -r6918 -r6923 --- branches/unlabeled/unlabeled-1.2.8/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 6918) +++ branches/unlabeled/unlabeled-1.2.8/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 6923) @@ -10,10 +10,13 @@ if( isset( $field_options['verify_field'] ) ) { $add_fields = Array(); - $options = Array('master_field' => $field_name, 'formatter'=>'kPasswordFormatter'); + $options = Array('master_field' => $field_name, 'formatter' => 'kPasswordFormatter'); if (isset($field_options['encryption_method'])) { $options['encryption_method'] = $field_options['encryption_method']; } + if (isset($field_options['salt'])) { + $options['salt'] = $field_options['salt']; + } $add_fields[ $field_options['verify_field'] ] = $options; $add_fields[$field_name.'_plain'] = Array('type'=>'string', 'error_field'=>$field_name); @@ -52,10 +55,10 @@ $fields = array_reverse($fields); $flip_count++; } - + + $salt = isset($object->Fields[$password_field]['salt']) ? $object->Fields[$password_field]['salt'] : ''; if( getArrayValue($object->Fields[$password_field], 'verify_field_set') && getArrayValue($object->Fields[$verify_field], 'master_field_set') ) { - $salt = isset($object->Fields[$password_field]['salt']) ? $object->Fields[$password_field]['salt'] : ''; $new_password = $object->GetDBField($password_field.'_plain'); $verify_password = $object->GetDBField($verify_field.'_plain'); Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/close_popup.tpl =================================================================== diff -u -r6906 -r6923 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 6906) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 6923) @@ -13,18 +13,27 @@ proceed_redirect(); } + function isset(variable) + { + if(variable == null) return false; + return (typeof(variable) == 'undefined') ? false : true; + } + function proceed_redirect() { if (window.opener) { // using popups & close_popup called (from anywhere) try { // parent window is ours - window.opener.location.href = $redirect_url.replace('%5C', '\\'); + var $skip_refresh = isset(window.opener.$skip_refresh) && window.opener.$skip_refresh ? true : false; + if (!$skip_refresh) { + window.opener.location.href = $redirect_url.replace('%5C', '\\'); + } window.close(); window.opener.focus(); } catch (err) { // another website is opened in parent window -// alert('proceed_redirect.Error: [' + err.description + ']'); + alert('proceed_redirect.Error: [' + err.description + ']'); } } else if (!$use_popups) {