problem with autologin gateway
-
hello,
i have put the code for the auto login in my index.php form theme, just after the get header, and i have this error :
Notice: Undefined index: user_auth in /some/thing/wp-content/plugins/wp-cassify/classes/wp_cassify_plugin.php on line 231
Is this the good place for this code ?
thank you
-
So i have find why it make this, it is something like a little bug.
I have many sites with same CAS. So when i go on the wordpress and don’t log, and after on another windows i go to an other site and log, if i comme back to the wordpress and reload the page, come the error.
I think it is why the plugin see that i am log on the cas, read the session but the session was made for the first time i go on and not log, and there is no auth_user in the session because it is the old one.I always have problems with gateway,
When i put it on the themes, no more link on the page are working. so when i go on the menu and click to go to anather page, it comes always on the first page. And if i am on another page, and make reload in the browser, i come on the first page.
I have try to put the gateway code before the get_header(); or after. but it is the same thing. No more link who works on the page. Always th first page. I see that the page reload, but it always come on the same page.
A small up.
I have always probleme with gateway autologin. I have fixed the différent Notice error.
But i still have probleme with the gateway, when someone juste a visitor is not logged, than he always be redirect to the home page also when he goes to a page for visitor people.
When he is logged than all work.
I have look at the CAS server and this comme to him :
GET /cas/login?service=https://mydom.dom/&gateway=true
so there is mydom.dom but the page who ask is mydom.dom/accueil/contact/then it is normal that it always return to the home page, how can i make the gateway script to have the real page to return ?
so something like GET /cas/login?service=https://mydom.dom/mycurrentpage/mycurrentpage/&gateway=true
Thank you
I don’t find the probleme.
- This reply was modified 7 years, 9 months ago by troussel.
Hello,
i have search were the problem is, and it is at the line 659 from classes/wp_cassify_plugin.php:
unset( $_SESSION[‘wp_cassify’][ $this->wp_cassify_current_blog_id ][‘auth_checked’] );
it make the site reload auf home.
I have try with a die before, i am on the good page.
A die just after and i am on the home page.
The unset from the session variable make the site reload and return to default page (home).
I have try with
$_SESSION[‘wp_cassify’][ $this->wp_cassify_current_blog_id ][‘auth_checked’] = NULL;
and it is the same.
with false it does not reload, but it does’nt work.
Is there a solution to fix it ?
So i have make many test, and found a bug in the code for gateway in template, but i don’t know how to fix it :
If i have a site with many page for visitor, and all have the same template with the gateway code :
i have home – page 1 – page 2 – page 3
i go as visitor not with account to home
then i click on Page 1, i stay on home, if i click a second time on page 1 i go to page 1 with notice error :
plugins/wp-cassify/classes/wp_cassify_plugin.php on line 231
if then i click on page 2, i go to Home. I must click another time on page 2 to go to page 2.
So every two page the gateway code make you go to Home with the redirect true in
classes/wp-classify-plugin.php at line 674.######another exemple######
if i am on home i click 1 time on page 1, i stay on home.
then i go to a second window from the browser, and i go to the CAS serveur, and i logged.
I come to the first window, and on my site i click on the Page 1, i come on the page 1, but don’t logged, then is the notice error :
classes/wp-classify-plugin.php at line 674
if i click again on page 1, i am logged but redirect to home and not on page 1.
Do i have mist something in the config ? or in the code in template ?
I have just the gateway code insert vor the get_header().
And i have cas 2
And {WP_CASSIFY_CURRENT_SERVICE_URL} in overide service URL
Thank you for a response.
Hello,
i have understand that what i wanted to do is not what the gateway make.
So i have change the plugin that the gateway can work like i want.
If you have page public, and page for subscriber and you want to have the gateway on every page that it can catch if somebody is always autentificated on the CAS server, then you can modify the plugin so, it is very simple :
in classes/wp_cassify_plugin.php :
i have create a public variable :
public $wp_cassify_mycurrentpage_uri;
then after in function wp_cassify_check_authentication()
i change
public function wp_cassify_check_authentication()
into
public function wp_cassify_check_authentication($myInput)and just after
$this->wp_cassify_session_start();
$auth = false;i put this
if ($myInput)
{
$this->wp_cassify_mycurrentpage_uri = $_SERVER[‘REQUEST_URI’];
}
else
{
$this->wp_cassify_mycurrentpage_uri = “”;
}then i change in the function : wp_cassify_redirect
the line
$service_url = $this->wp_cassify_get_service_callback_url();
into
$service_url = $this->wp_cassify_get_service_callback_url().$this->wp_cassify_mycurrentpage_uri;
And that’s all for the plugin.
After in the gateway code of your template you just have to make this if you want to have a gateway on all the page and not be redirect to the home page if you are not logged (see the true into the () ) :
if ( (! is_user_logged_in() ) && (! get_query_var( ‘wp_cassify_bypass’ ) ) ){
if ( isset($GLOBALS[‘wp-cassify’]) ) {
$GLOBALS[‘wp-cassify’]->wp_cassify_check_authentication(true);
}
}
else if ( ! is_user_member_of_blog() ) {
if ( isset($GLOBALS[‘wp-cassify’]) ) {
$GLOBALS[‘wp-cassify’]->wp_cassify_check_authentication(true);
}
}if you want the old gateway code, then you just don’t put the true into the ().
Hi,
OK so i close thread.
Best regards.
- The topic ‘problem with autologin gateway’ is closed to new replies.