When running Certificate Login on a non-standard port, e.g. https://www.example.com:8443, the login fails because the form action URL is https://www.example.com/login when it should be https://www.example.com:8443.

Replacing $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] in line 97 of certificatelogin.module seems to fix this (at least on Debian etch with Apache 2).

Old version of line 97:

$form['#action'] = 'https://'.$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];

New version of line 97:

$form['#action'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];

Comments

tony_cowderoy’s picture

Correction! The first sentence should read:

When running Certificate Login on a non-standard port, e.g. https://www.example.com:8443, the login fails because the form action URL is https://www.example.com/login when it should be https://www.example.com:8443/login

flamingvan’s picture

Thanks for that, tony_cowderoy. I am going to make the changes soon and release new versions. Just a couple of work hurdles to get through first.

flamingvan’s picture

Tony,
I've made the change. Getting CVS to work always seems to take the most time for me...
Thanks,
Moses

tony_cowderoy’s picture

Thanks. I've just installed the new version and it seems to work just fine.
Tony

tony_cowderoy’s picture

Oops! I wrote too soon. I must have been testing the wrong installation. It doesn't work.

You have changed:

$form['#action'] = 'https://'.$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];

to

$form['#action'] = 'https://'.$_SERVER['SERVER_HOST'].'/'.$_SERVER['REQUEST_URI'];

In my PHP installation there is no such value as $_SERVER['SERVER_HOST'].

It should be:

$form['#action'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];

BTW, ISTR that I made exactly the same mistake when I first tried to fix it.

Tony

flamingvan’s picture

All set. I totally do not get CVS. I finally got that updated but it always takes me forever. I installed tortoise and that helps a little I guess.

flamingvan’s picture

Status: Active » Fixed

fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.