.Now, more weirdness:I tried commenting out the redirection after the login,and guess what:My translated flash message appeared!But Of course,no redirection.If I bring in the redirection line:no flash message.I tried moving the setFlash function to every possible position inside the if block,but no luck… thought flash messages are available on the same AND next page.I will appreciate any helpful tip-idea,thanks in advance.
That’s strange. Below is some very similar code I wrote a while ago, where the flash message does work on login:
if(isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
if($model->validate() && $model->login()) {
// Get the user
if(Yii::app()->user->checkAccess("data-entry")) {
$this->redirect(array('/admin/data_entry'));
} else {
Yii::app()->user->setFlash('login', "You've been logged in successfully");
$this->redirect(array('/business/update'));
}
}
}
Are you sure that on the page you’re redirecting to, you are checking for a set flash message and then displaying it? Unless you have it in your main template/layout files.
If you have no luck, I suggest setting up a temporary page that just displays the ‘success’ flash message, and redirect to that page on login.
It has to do with the translation.Has to be a bug.If I switch the application language to english,eveything works as expected:the un-translated flash message appears on the redirection page.If I switch to Greek,the translated flash message will appear only on the same page.This is totally bizzare,and I think beyond anyone’s ability to resolve,since it is probably a bug.I wont spent more time on this,I will probably write an ajaxified login process.Thanks to everybody who took the time to help me,Cheers!
The problem was with my session table,the table and field collation was not set to utf8_general_ci,so my translated flash message could not be stored properly and passed to the redirection page.
Hope that helps someone.
Again,many thanks to everybody who took the time to help me.