Forgot Your Username with security question and answer j1.5

Your code modifications and patches you want to share with others.
User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

Forgot Your Username with security question and answer j1.5

Postby arjuninfo » Fri Oct 09, 2009 6:35 am

Forgot Your Username with security question and answer with joomla 1.5
You do not have the required permissions to view the files attached to this post.
M.Arjun

User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

Forgot Your Username in joomla 1.5

Postby arjuninfo » Fri Oct 09, 2009 6:38 am

Insert this code in

components\com_user\views\remind\tmpl\default.php


<div class="content_title"><span class="blue">Forgot </span><span class="dark_blue">Your Username</span></div>
<div style="margin-left:40px; margin-top:20px; width:500px;">
<form action="index.php?option=com_user&amp;task=remindusername&Itemid=213" method="post" name="josForm" id="josForm" class="form-validate" style="padding:0; margin:0;" onSubmit="return ValidateForm()">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="contentpane">
<tr>
<td colspan="2">
<font color="#0099FF">
<?php
/*if(isset($this->username))
{
echo "YOUR USERNAME : ".$this->username;
}*/

echo $_GET['msg'];
?>

</font> </td>
</tr>
<tr>
<td style="padding-top:30px" width="140">
<div align="left">
<label id="" for="security" class="page-content-2">
<span class="astriek">* </span>
<?php echo JText::_('Security Question'); ?></label>
</div> </td>
<td style="padding-top:30px">
<div align="left">
<?php echo $this->lists['security'];?> </div> </td>
</tr>
<tr>
<td style="padding-top:30px">
<label id="" for="answer" class="page-content-2">
<span class="astriek">* </span><?php echo JText::_( 'Your Answer' ); ?> </label> </td>
<td style="padding-top:30px">
<input title="Please Enter Your Answer" class="inputbox req val textbox_bg" type="text" id="answer" name="answer" value="<?php echo JRequest::getVar('answer');?>" maxlength="100" style="width:275px; "/> </td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="astriek">* </span>Email Id </td>
<td><input id="email" name="email" type="text" class="required validate-email textbox_bg" style="width:275px; " maxlength="100" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="Submit" style="margin-left:230px;" value="<?php echo JText::_('Submit'); ?>" /> </td>
</tr>
</table>

<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
Last edited by arjuninfo on Fri Oct 09, 2009 6:44 am, edited 1 time in total.
M.Arjun

User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

Custom fields in joomla 1.5 Forgot your username

Postby arjuninfo » Fri Oct 09, 2009 6:42 am

then goto

components\com_user\controller.php


function remindusername()
{
$db =& JFactory::getDBO();

// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

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

$security = JRequest::getVar('security', null, 'post', 'string');

$answer =JRequest::getVar('answer', null, 'post', 'string');


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

$query = "SELECT username FROM jos_users WHERE email='".$email."' AND security='".$security."' AND answer='".$answer."'";

$db->setQuery($query);
$member_info = $db->loadObjectList();


/* print "<pre>";
print_r($member_info);


if(!empty($member_info)){
print 'if';
}
else
{
print 'else';
}exit();*/

if(($model->remindUsername($email) === false) && (empty($member_info)))
{

$message = JText::sprintf('USERNAME_REMINDER_FAILED', $model->getError());
$this->setRedirect('index.php?option=com_user&view=remind&Itemid=212&msg=Please enter a correct answer', $message);
return false;


}

$message = JText::sprintf('USERNAME_REMINDER_SUCCESS', $email);
$this->setRedirect('index.php?option=com_user&view=remind&Itemid=212&msg=Please check your mail for username details', $message);


}



function _sendMail(&$user, $password)
M.Arjun

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11063
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Forgot Your Username with security question and answer j1.5

Postby ooffick » Fri Oct 09, 2009 10:32 am

Mod Note: Moved to Core Hacks Forum
Olaf Offick - Global Moderator
http://learnskills.org

paresh12
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Mar 14, 2011 9:59 am

Re: Forgot Your Username with security question and answer j

Postby paresh12 » Mon Mar 14, 2011 10:56 am

Hello Arjun

Thanks for nice post.

Can you please tell me how can i add question and database fields?

Currently security question form display in forget username page but not comes on registration page. :'(

Can you please provide full code?

Thanks


Return to “Core Hacks and Patches”

Who is online

Users browsing this forum: No registered users and 1 guest