I have a page called "page 1". It has a area called "area 1"(please see the pic). In side area 1 there is a form. But the form shows only after log in. So I have give link to log in page(please see the pic). But after log in how should i redirect back to the page 1. I have searched for a solution and found it involves "returnUrl". So my first question is how and where should I set "returnUrl" to the above task.
And from below code I have notices return url and other data in $_SESSION. How can I access them.
A image of the result is attached with this.
// validate user input and redirect to the previous page if valid
if($model->validate() && $model->login())
echo '<pre>' . print_r($_SESSION, true) . '</pre>';die; ///////// here
But then every time you login you will redirected to page 1. isn’t it? if a page 2 also a restricted page and when some one try to access page 2 he also will be redirect to page 1 after log in instead of redirecting to page 2.
I want like given below
User goes to page 1.
User cannot see the form in area 1.
To see it he click on login link.
User is in login page and he enter login details.
User is redirected back to page 1 and he can see the form in area 1.
My problem is how to do number 5 task. Because he is now loged in he can see the form in area 1.
you are right nuwan. but redirecting the user to returnUrl will leads to redirect the user the previous page before login. if returnUrl doesnot works as expected there is another way also available do like this in controller