hey guys i need to create forget password link.can anyone give idea for that with tutorials or sample code.thanx for ur help
hey guys i need to create forget password link.can anyone give idea for that with tutorials or sample code.thanx for ur help
I implemented it using a Login Portlet. In the userLogin view, I dropped in a submit button with a ‘command’ parameter as seen here (I use a bootstrap button widget):
<?php
$this->widget('bootstrap.widgets.TbButton',array(
'label' => 'Forgot password',
'htmlOptions'=>array(
'submit'=>'',
'params'=>array(
'command'=>'forgotpassword',
),
),
));
?>
In the UserLogin class, I have code similar to this:
class UserLogin extends Portlet {
public $title='Login';
protected function renderContent() {
if (isset($_POST['command']) && ($_POST['command']==='forgotpassword' || $_POST['command']==='reset')) {
$this->resetRender();
return;
}
$this->loginRender();
}
private function loginRender() {
$this->render('userLogin',array('model'=>new LoginForm('login')));
}
private function resetRender() {
if(isset($_POST['LoginForm']) && isset($_POST['command']) && $_POST['command']==='reset')
{
// Reset password using $_POST information.
}
$this->render('userReset',array('model'=>new LoginForm('reset')));
}
}
Note the $_POST[‘command’]===‘xxx’. This is what I use to determine whether I’m showing the userLogin view, or the userReset view that I created (almost a clone of userLogin).
In the userReset view, I will in turn have a button that triggers the code to reset the user password:
<?php
$this->widget('bootstrap.widgets.TbButton',array(
'label' => 'Reset',
'htmlOptions'=>array(
'submit'=>'',
'params'=>array(
'command'=>'reset',
),
),
));
?>
This is not my full code as I have a lot more inline junk, but it should help you achieve something similar to what I have. Hope it helps!