0
protected function postSaveHook(JModel &$model, $validData = array())
{
    // Get a handle to the Joomla! application object
    $application = JFactory::getApplication();

    $date = date('Y-m-d H:i:s');
    if($validData['date_created'] == '0000-00-00 00:00:00'){
        $data['date_created'] = $date;
    }
    $data['date_modified'] = $date;

    $user = JFactory::getUser();
    if($validData['user_created'] == 0){
        $data['user_created'] = $user->id;
    }
    $data['user_modified'] = $user->id;
    //$password = md5($this->form->getValue('password'));
    //$data['password'] = $password;
    $post = JRequest::getVar('jform');
    $data['password'] = md5($post['password']);
    $model->save($data);

}

the fields form:

        <div class="adminformlist">
            <?php foreach($this->form->getFieldset('details') as $field){ ?>
                <div>
                    <?php echo $field->label; echo $field->input;?>
                </div>
                <div class="clr"></div>
            <?php }; ?>
        </div>

I'am saving an md5 hash to the database after getting the password, but when I'am editing that user the password field is refilled with the md5 hash code, so how can I avoid that?

I need the password field empty, but the fields are filled in foreach loop, I've tried to set the default value in the xml, but it didn't work

the joomla library is very huge, I didn't find any methods to that, maybe someone knows?

joomla 2.5

user3016968
  • 99
  • 1
  • 4
  • 10
  • you don't really want to hash your users' passwords with md5 – STT LCU Nov 21 '13 at 10:13
  • I'am creating a custom user in the component, custom login, custom password, this works, but when I need to edit a user I get refilled the password field with md5 hash, I need that field empty – user3016968 Nov 21 '13 at 10:17
  • @STTLCU - Joomla actually use md5 for hashing user password, but then again, they also salt them as well. – Lodder Nov 21 '13 at 11:15
  • @user3016968 - Have a look at the Joomla library and see how the edit function works. You might also want to change `JRequest` is this is deprecated in Joomla 2.5 – Lodder Nov 21 '13 at 11:16
  • How your script to load form look like? – Adam Bubela Nov 21 '13 at 13:57
  • I've used the standart component creator, nothing special, can anyone give a me a link to the example file in joomla?, where can I see that? all the edit fields a re filled everywhere, but what about password I don't know what to do, please help – user3016968 Nov 21 '13 at 14:46

0 Answers0