Modyfikacja com_user reset hasła (przeniesienie pola token)

Locked
rkoczen
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Oct 13, 2010 9:35 am

Modyfikacja com_user reset hasła (przeniesienie pola token)

Post by rkoczen » Wed Oct 13, 2010 9:43 am

Mój problem polega na tym że chciałbym aby przenieść pole token pod pola Password i Retype password, po prostu chcę zrobić o jedno kliknięcie mniej aby użytkownik mógł wpisać nowe hasło i token w jednym kroku. Wszelkie zmiany jakie robiłem tyczą się komponentu user.

/**
* Password Reset Confirmation Method
*
* @access public
*/
function confirmreset()
{
// Check for request forgeries
//JRequest::checkToken() or jexit( 'Invalid Token' );

// Get the input
//$token = JRequest::getVar('token', null, 'post', 'alnum');

// Get the model
//$model = &$this->getModel('Reset');

// Verify the token
/*if ($model->confirmReset($token) === false)
{
$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');
}

/**
* Password Reset Completion Method
*
* @access public
*/
function completereset()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

// Get the input
$token = JRequest::getVar('token', null, 'post', 'alnum');
$password1 = JRequest::getVar('password1', null, 'post', 'string', JREQUEST_ALLOWRAW);
$password2 = JRequest::getVar('password2', null, 'post', 'string', JREQUEST_ALLOWRAW);

// Get the model
$model = &$this->getModel('Reset');

// Reset the password
if ($model->completeReset($password1, $password2) === false)
{
$message = JText::sprintf('PASSWORD_RESET_FAILED', $model->getError());
$this->setRedirect('index.php?option=com_user&view=reset&layout=complete', $message);
return false;
}

$message = JText::_('PASSWORD_RESET_SUCCESS');
$this->setRedirect('index.php?option=com_user&view=login', $message);
}

Zmiany w widokach confirm.php (tutaj wyrzuciłem pole token) i complete.php (tutaj wkleiłem ten kod z tokenem)

<?php defined('_JEXEC') or die; ?>

<div class="componentheading">
<?php echo JText::_('Confirm your Account'); ?>
</div>

<form action="index.php?option=com_user&task=confirmreset" method="post" class="josForm form-validate">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
<tr>
<td colspan="2" height="40">
<p><?php echo JText::_('RESET_PASSWORD_CONFIRM_DESCRIPTION'); ?></p>
</td>
</tr>
</table>

<button type="submit" class="validate"><?php echo JText::_('Submit'); ?></button>
<?php echo JHTML::_( 'form.token' ); ?>
</form>



Zmieniony kod confirm.php

<?php defined('_JEXEC') or die; ?>

<div class="componentheading">
<?php echo JText::_('Reset your Password'); ?>
</div>

<form action="index.php?option=com_user&task=completereset" method="post" class="josForm form-validate">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
<tr>
<td colspan="2" height="40">
<p><?php echo JText::_('RESET_PASSWORD_COMPLETE_DESCRIPTION'); ?></p>
</td>
</tr>
<tr>
<td height="40">
<label for="password1" class="hasTip" title="<?php echo JText::_('RESET_PASSWORD_PASSWORD1_TIP_TITLE'); ?>::<?php echo JText::_('RESET_PASSWORD_PASSWORD1_TIP_TEXT'); ?>"><?php echo JText::_('Password'); ?>:</label>
</td>
<td>
<input id="password1" name="password1" type="password" class="required validate-password" />
</td>
</tr>
<tr>
<td height="40">
<label for="password2" class="hasTip" title="<?php echo JText::_('RESET_PASSWORD_PASSWORD2_TIP_TITLE'); ?>::<?php echo JText::_('RESET_PASSWORD_PASSWORD2_TIP_TEXT'); ?>"><?php echo JText::_('Verify Password'); ?>:</label>
</td>
<td>
<input id="password2" name="password2" type="password" class="required validate-password" />
</td>
</tr>
<tr>
<td height="40">
<label for="token" class="hasTip" title="<?php echo JText::_('RESET_PASSWORD_TOKEN_TIP_TITLE'); ?>::<?php echo JText::_('RESET_PASSWORD_TOKEN_TIP_TEXT'); ?>"><?php echo JText::_('Token'); ?>:</label>
</td>
<td>
<input id="token" name="token" type="text" class="required" size="36" />
</td>
</tr>

</table>

<button type="submit" class="validate"><?php echo JText::_('Submit'); ?></button>
<?php echo JHTML::_( 'form.token' ); ?>
</form>



Co jescze muszę zrobić bo wydawało mi się że już wszytsko ok. ale nie mogę wejść do complete:) Czyli do ostatniego widoku:)

Locked

Return to “Modyfikacje i własne rozwiązania”