I want to change my website URL after any user logged in my website.
Suppose my website URL is www.xyz.com. Now if any user is logged in website the chane URL www.xyz.com to www.my.xyz.com
Related
i have a site
http://mysite.test/login
now if i will attempt
http://mysite.test/admin
it will redirect me to
http://mysite.test/login
this is very fine. but now i have subdomain for same site.
http://company.mysite.test/
and this URL serves as login page as well. but when i hit
http://company.mysite.test/admin
it is redirecting me to
http://company.mysite.test/login
which is is entirely wrong. it must be redirected to
http://company.mysite.test/
for subdomain. what should i do?
Change you login route to Route::get('/');
you'll also need to make changes to your Authenticate middleware that manages redirects to login page.
I am quite newbie to codeigniter, I have login system to start with on site, and have 2 scenario:
If user is already logged in, and if clicks on url from other site(different domain), then it will redirect to given link.
If user is not logged in and click on link from other domain then he will first redirect to login page and then he will redirect again to clicked link.
now my first case works but not second, I tried setting a url in session like,
$array['login_redirect'] = current_url();
$this->session->set_userdata($array);
which is giving me correct url
but after login, session data shows login page url as value for login_redirect.
You need to add condition to set current url.
for Example:
$current_url = current_url();
$login_url = 'www.test.com/login'; // Login url of current website
if($current_url != $login_url){
$array['login_redirect'] = $current_url;
$this->session->set_userdata($array);
}
You can save current url in session when user is not logged in and don't do it when user is on login page - then you can read link from session and it will be link to last visited page.
Another solution is to save url to page in cookie when user clicks on link and then you can read it in PHP and redirect user to correct page.
Third solutiuon is to send this link via POST or GET when user is redirected to login page.
I have created a custom landing page hook in Liferay6.2.
Suppose user enters abc.com/xyz. Then after login he should not be redirected to my custom landing page. Instead he should be redirected to xyz post login.
My landing page should be selected only when he enters abc.com
How to implement this.
This can be fetched using below code in your PostLogin Hook
LastPath lastPath = (LastPath) session.getAttribute(WebKeys.LAST_PATH);
It performed good in localhost but when i test in live server site in admin panel it redirect to login panel after successful login .. firstly goto home page then without entering to home it redirect back url to login url.
I research every sector but not find my solutions.
Lastly,I found it redirect from vendor/symfony.../httpfondation/redirctresponse.php
guys can you help me to find out this error.
I need to manage login in such a way that it should redirect the control after successful login to the page which call login method in pyrocms.
By default it return control to Home Page. for example i want to go gallery page but it require user to be logged in so it will redirect control to the login page and now i want to redirect the control back to the gallery page once the user successful logged in.
Finally, i have come with the exact solution which is working correctly for me.
Whenever user try to view the gallery page(restricted page) which require user login, we have to only assign the URL where we want to redirect after successful login in $redirect_to in the controller method:
$this->session->set_userdata('redirect_to',$redirect_to);
Then it will automatically redirect the control to the desired page. Because in the users controller the login function is developed in such a way that:
$redirect_to = $this->input->post('redirect_to') ? $this->input->post('redirect_to') : $this->session->userdata('redirect_to');
Hopefully this will help you sometime