Difference between revisions of "Why do you get a Token Error when you confirm a password reset?"

From Joomla! Documentation

Line 13: Line 13:
 
== What specifically must be added to the file? ==
 
== What specifically must be added to the file? ==
  
All Template Overrides can be different, so this is an example of how you would apply this fix if using YOOtheme Templates or template overrides based on YOOtheme's Custom Template Overrides[http://www.yootheme.com/member-area/downloads/item/templates-15/template-overrides-15], like RocketTheme's [http://www.gantry-framework.org Gantry Layouts]. If you created your own layouts or used layouts from someone else, your changes may be slightly different.  
+
All Template Overrides can be different, so this is an example of how you would apply this fix if using YOOtheme Templates or template overrides based on YOOtheme's Custom [http://www.yootheme.com/member-area/downloads/item/templates-15/template-overrides-15 Template Overrides], like RocketTheme's [http://www.gantry-framework.org Gantry Layouts]. If you created your own layouts or used layouts from someone else, your changes may be slightly different.  
  
 
A label and field for username must be added to the form, as pictured below:
 
A label and field for username must be added to the form, as pictured below:

Revision as of 01:53, 30 April 2010

If you are getting a Token Error when confirming a password reset after upgrading to Joomla! 1.5.16, or later, and if you are using Template Overrides for the com_user Component, reset view, and confirm layout, then you must manually change your layout file to include a new username field. Adding that field will fix the token error.

How can I tell if I need to make this change?[edit]

On your Joomla! installation, see if you have a file a templates/current-template-name/html/com_user/reset/confirm.php file.

Note: substitute the actual name of your template for current-template-name.

If the confirm.php file exists at that location, then you need to make certain the new username field has been added.

If you do not have this file, then this issue does not relate to you.

What specifically must be added to the file?[edit]

All Template Overrides can be different, so this is an example of how you would apply this fix if using YOOtheme Templates or template overrides based on YOOtheme's Custom Template Overrides, like RocketTheme's Gantry Layouts. If you created your own layouts or used layouts from someone else, your changes may be slightly different.

A label and field for username must be added to the form, as pictured below:

<div>
	<label for="username" class="hasTip" title="<?php echo JText::_('RESET_PASSWORD_USERNAME_TIP_TITLE'); ?>::<?php echo JText::_('RESET_PASSWORD_USERNAME_TIP_TEXT'); ?>"><?php echo JText::_('User Name'); ?>:</label>
	<input id="username" name="username" type="text" class="required" size="36" />
</div>

Where should that be placed within the file?[edit]

In the RocketTheme Gantry layouts, the new label and field is placed below the "Confirm your Account" literal and above the existing token field. When you are complete, the form should loook like this.

<div class="user">

	<h1 class="rt-pagetitle">
		<?php echo JText::_('Confirm your Account'); ?>
	</h1>

	<p>
		<?php echo JText::_('RESET_PASSWORD_CONFIRM_DESCRIPTION'); ?>
	</p>

	<form action="<?php echo JRoute::_( 'index.php?option=com_user&task=confirmreset' ); ?>" method="post" class="josForm form-validate">
	<fieldset>
		<legend><?php echo JText::_('Confirm your Account'); ?></legend>
		
		<div>
			<label for="username" class="hasTip" title="<?php echo JText::_('RESET_PASSWORD_USERNAME_TIP_TITLE'); ?>::<?php echo JText::_('RESET_PASSWORD_USERNAME_TIP_TEXT'); ?>"><?php echo JText::_('User Name'); ?>:</label>
			<input id="username" name="username" type="text" class="required" size="36" />
		</div>

		<div>
			<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>
			<input id="token" name="token" type="text" class="required" size="36" />
		</div>
		<div class="readon">
			<button type="submit" class="button"><?php echo JText::_('Submit'); ?></button>
		</div>
			
	</fieldset>
	<?php echo JHTML::_( 'form.token' ); ?>
	</form>
</div>