here is the problem: When i do the login with the credentials that i gave to you, and then try to make the logout without refreshing the page, the ajax function does not refresh to the new button id, and when you make a logout and try to login right away, the submit button works like a submit button and not like an ajax submit button.
you can test it here:
ht tp:// teste.qiteam.org </p>
login -> 123@123.com</p>
pass -> testing
here is the code:
// Code at this moment.
// Login View
<?php
if (!isset($model))
$model = new LoginForm;
echo "<h3>Login</h3>";
echo CHtml::beginForm('login');
echo CHtml::errorSummary($model);
echo"<div class='row'>";
echo CHtml::activeLabel($model,'username');
echo CHtml::activeTextField($model,'username');
echo"</div>
<div class='row'>";
echo CHtml::activeLabel($model,'password');
echo CHtml::activePasswordField($model,'password');
echo "</div>
<div class='row'>";
echo CHtml::activeCheckBox($model,'rememberMe');
echo CHtml::activeLabel($model,'rememberMe');
echo "</div>
<div class='row submit'>";
echo CHtml::ajaxSubmitButton('Login',array('/login'),array('update' => '#panel_contents'),array('live'=>false));
echo "</div>";
echo CHtml::endForm();
?>
// Index Panel Widget
class index extends CWidget
{
public function run()
{
if ( Yii::app()->user->isGuest)
$this->render('login');
else
{
$username = Yii::app()->user->firstname . " " . Yii::app()->user->lastname;
echo " <h3> Hi, $username " ;
echo CHtml::ajaxLink('Logout',array('/logout'),array('update' => '#panel_contents'),array('live'=>false,'id'=>'logoutLink'));
echo "</h3>";
}
}
}
// Login Action
$model = new LoginForm;
if (isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
if ($model->validate())
$this->renderPartial('update');
}
else
{
$this->renderPartial('update');
}
// logout Action
public function actionLogout()
{
Yii::app()->user->logout();
$this->renderPartial('update');
}
// update view
<?php
$this->widget('application.extensions.panel.index')
?>
Thank you