I noticed some not very user friendly situation during an ajax execution. Here is the situation:
I have setup the loginUrl to be my index page so when login session expires the user gets redirected to my index page.
I click on a button which triggers an ajax call and updates a specific div of the webpage. What happens though is after the ajax is been triggered the application has decided that the login session has expired and the result is my whole index webpage gets loaded into the ajax update section. Has anybody else seen that? It looks very unprofessional and ugly. I couldn’t find related posts so I raised this one. Any advice on how to deal with this situation is welcome.
I have a dirty (but working) solution, that needs to be a bit cleaned. Look at this:
* Displays the login page
public function actionLogin()
if (Yii::app()->request->urlReferrer!== Yii::app()->request->hostInfo.CHtml::normalizeUrl(array('/site/login')))
//the usual login action
Is a modified version of the login page. It checks if the previous page was login too, if is it will as usual shows the login form and login if succesfully.
The problem is that the user will be redirected 2 times:
the first time the ref is the page from wich is the request
the second the ref is corrected, so the login is displayed correctly
that is the dirty point: if is possible to find any way for understand if the request from wich we were redirect was an ajax request, we can put this condition in the "if" and avoid to redirect 2 times