Skip to content

Instantly share code, notes, and snippets.

@michaelhjulskov
Last active June 16, 2016 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelhjulskov/e9ad06a5218ab1ff2bb1 to your computer and use it in GitHub Desktop.
Save michaelhjulskov/e9ad06a5218ab1ff2bb1 to your computer and use it in GitHub Desktop.
Prestashop FrontController override of redirect after login
<?php
class FrontController extends FrontControllerCore
{
public function getRedirectAuthenticationURL(){
$http = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='Off' && !empty($_SERVER['HTTPS'])) ? "https://" : "http://");
if ($_SERVER['QUERY_STRING']){ // example=1&example2=2
return urlencode($http.$_SERVER["HTTP_HOST"].$_SERVER['REQUEST_URI']);
} else {
return ($this->authRedirection ? $this->authRedirection : '');
}
}
public function init()
{
$this->authRedirection = $this->getRedirectAuthenticationURL();
parent::init();
}
}
@michaelhjulskov
Copy link
Author

please contrib if you see a better solution!

@jsbmudit
Copy link

jsbmudit commented Jun 16, 2016

Hey Man!!
I Need Your Help Please..
I Have Been Trying To Solve a Problem from the past 20 days and still cant find any solution..

I am having problem in my Domain www.babosasakhi.com

I installed ssl certificates on my website around 30 days ago from cloudflare.com by routing nameservers to cloudflare..

I Have a Prestashop Website

After around 20 days i realised it is decreasing my website's performance, so i decided to uninstall the certificate and reroute nameservers to Hostgator, and i did that.

From then Onward i am having problem in accessing admin panel of prestashop without ssl i.e., on http when i try to login it redirects to the same url adding "&redirect=AdminDashboard" to it.. and https is not available as i deleted it (Please Find Attachments)

So i decided to Delete whole prestashop installation and reinstall it and start fresh again..

But Still the Problem Persists..

the same problem when i try to login in Prestashop admin Panel it Redirects me and nothing happens (Please Find Attachments)

I Even tried to delete add on Domain and then again add it and again installed prestashop but still same issue..

Please Help with this redirection issue...
after entering my login details
when i enter wrong password
when i open admin link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment