Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 0 Ответов
  • 3220 Просмотров

Это проблема наверно коснулась каждого пятого разработчика - когда командой index.php?option=com_user&view=reset&layout=confirm - сбрасывают всякие .нах..
пароль в админку. Страдал от этой проблемы долго - пока не коментнул нижеприведенные функции . такая фича:


File : /components/com_user/controller.php

#####################################################################################
Line : 379-399
 
   function confirmreset()
   {
      // Check for request forgeries
      JRequest::checkToken() or die( 'Invalid Token' );

      // Get the input
      $token = JRequest::getVar('token', null, 'post', 'alnum');              < --- {1}
                 
      // Get the model
      $model = &$this->getModel('Reset');

      // Verify the token
      if ($model->confirmReset($token) === false)   < --- {2}
      {
         $message = JText::sprintf('PASSWORD_RESET_CONFIRMATION_FAILED', $model->getError());
         $this->setRedirect('index.php?option=com_user&view=reset&layout=confirm', $message);
         return false;
      }

      $this->setRedirect('index.php?option=com_user&view=reset&layout=complete');
   }
   
#####################################################################################
   
File : /components/com_user/models/reset.php

Line: 111-130    
   
   
   
   function confirmReset($token)
   {
      global $mainframe;

      $db   = &JFactory::getDBO();
      $db->setQuery('SELECT id FROM #__users WHERE block = 0 AND activation = '.$db->Quote($token));  < ---- {3}

      // Verify the token
      if (!($id = $db->loadResult()))
      {
         $this->setError(JText::_('INVALID_TOKEN'));
         return false;
      }

      // Push the token and user id into the session
      $mainframe->setUserState($this->_namespace.'token',   $token);
      $mainframe->setUserState($this->_namespace.'id',   $id);

      return true;
   }
#####################################################################################



{1} - Replace ' with empty char
{3} - If you enter ' in token field then query will be looks like : "SELECT id FROM jos_users WHERE block = 0 AND activation = '' "
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться