Page 1 of 5

Proposed Solution: Double Login Issues

Posted: Sat Oct 21, 2006 10:08 pm
by friesengeist
Hi everyone,

there are quite a few users who are experiencing problems upon their first frontend login, however, the login works the second time for most of them. The corresponding threads are at least these:
http://forum.joomla.org/index.php/topic,76935.0.html
http://forum.joomla.org/index.php/topic,92425.0.html
http://forum.joomla.org/index.php/topic,67290.0.html
http://forum.joomla.org/index.php/topic,87929.0.html
http://forum.joomla.org/index.php/topic,72398.0.html
http://forum.joomla.org/index.php/topic,71369.0.html

I believe that most of these issues occur for users visiting your page from a URL other than the livesite URL set in your global config. Lets imagine your livesite URL is http://www.example.com, but a user visits you under example.com. Indeed, there is no possibility for this user to login on the first attempt. Now, if you encounter such problems, you might be lucky, as some (if not all) these issues have been identified.

If you are willing to test this proposed solution, please follow these steps. But before you start, keep in mind that all such changes could as well break your site, so I wouldn't use it on a production system, but rather only on a test system.
  • Use the attached files only on Joomla! 1.0.11. They are not compatible with other versions!
  • Make a backup of the files /includes/joomla.php and /modules/mod_login.php first.
  • Download the zip-file which is attached to this post, und unzip it to a temporary location.
  • Overwrite /includes/joomla.php with joomla.php.
  • Overwrite /modules/mod_login.php with mod_login.php.
  • If you have set a value for the "Login Redirection URL" for the login module, please delete it or make sure the domain matches the domain you use as your live_site in global configuration.
  • Please report back if you are still experiencing any login issues.
As said, I would never use any patches directly on a production server, so use them only on a testing server or know what you are doing :)

Looking forward to your feedback,
Enno

Re: Proposed Solution: Double Login Issues

Posted: Sat Oct 21, 2006 10:46 pm
by retromodcoza
This works Lekker!

Nice - IE and FireFox both login , both on http:// and http://www and first time too.

Installed brand new site , and there was this login problem , then put patch , and perfect!

I then put it on my live site , and it worked perfectly.

Now I have a suggestion : Go get a few beers and celebrate. I now have 12 sites that have login capability!

Seriously....Paypal Address? Send me email.....

Re: Proposed Solution: Double Login Issues

Posted: Mon Oct 23, 2006 9:49 am
by cyberbo
Hi,

I have also try and it works fine for me to....

Thanks...

/cyberbo

Re: Proposed Solution: Double Login Issues

Posted: Mon Oct 23, 2006 3:58 pm
by raschidt
thanks.

All it´s fine! :D

Re: Proposed Solution: Double Login Issues

Posted: Mon Oct 23, 2006 7:35 pm
by technopuzzle
What about adding the following to the configuration.php file? I've found that this fixes the whole issue of sites being accessed from http://www.domain.com or domain.com.

Code: Select all

$mosConfig_live_site = 'http://' . $_SERVER['HTTP_HOST'];

Re: Proposed Solution: Double Login Issues

Posted: Tue Oct 24, 2006 8:31 am
by lysetskilde
THank you  :P
unixboymd

Just what I needed

I began to sweat :o  because I got this problem with log in and my users start writingand I did what you told to do with the configuration.php file,

Thank You once again.

Torben

Re: Proposed Solution: Double Login Issues

Posted: Tue Oct 24, 2006 8:38 pm
by JerkyPenguin
Fan &*$%ing -tastic!!!

Great job!  Thanks so much!  Go Joomla! :laugh:

Re: Proposed Solution: Double Login Issues

Posted: Tue Oct 24, 2006 8:56 pm
by mcsmom
I don't know why this isn't considered the standard fix for so many of these problems.

Re: Proposed Solution: Double Login Issues

Posted: Tue Oct 24, 2006 9:23 pm
by technopuzzle
Me either. I found it in the forums someplace.

Re: Proposed Solution: Double Login Issues

Posted: Tue Oct 24, 2006 10:04 pm
by shumisha
Hello all,

I never had this problem, but I am doing something that will also fix this, by adding the following to my .htaccess :

Code: Select all

RewriteCond %{HTTP_HOST} ^mydomain\.com [NC]
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L,NC]
every request form mydomain.com/xxxx is redirected to http://www.mydomain.com/xxxx, through a permanent redirection (you can do it the other way around if you like of course, from www to non-www).

The big advantage (that was the reason to do it in the first place) is to avoid duplicate-content penalties in search engines, as your site is going to be indexed twice. if you do not do something like that mydomain.com/mypage.html and http://www.mydomain.com/mypage.html will have same content on the same domain, but differing sub-domain and URL.

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 12:42 pm
by mcsmom
;)
http://forum.joomla.org/index.php/topic ... #msg464303

Someone showed it to me back on Mambo.

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 1:48 pm
by TheWagner
So the .htaccess the safest method? I've placed the code into my .htaccess file, but its not working. Does something need to be removed, or do these lines need to be in a specific place?  Sorry for the confusion. I'm new to this.

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 2:11 pm
by davemacd
Still getting the same issue after applying this patch on my Joomla site running under IIS (so I can't use .htaccess method).

The only fix I can find that works is either ticking the remember me box or checking the login message parameter on the login module which says "You are now logged in". These work - but aren't great solutions !

Have tried removing my login redirection, tried the attached files, tried the other '0' session fix - but still not working as it was before  :(

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 8:33 pm
by friesengeist
unixboymd wrote: What about adding the following to the configuration.php file? I've found that this fixes the whole issue of sites being accessed from http://www.domain.com or domain.com.

Code: Select all

$mosConfig_live_site = 'http://' . $_SERVER['HTTP_HOST'];
Joomla! 1.5 is doing something quite similiar - no mosConfig_live_site anymore. I doubt it though that this will change for 1.0.x - it changes behavior, and is probably out of scope of a stability release. I can also see one problem arise from this change: let's imagine your users log in on http://www.example.com. Now lets assume you have a hardcoded Link in your content to example.com/index.php?whatever. The user logged in on http://www.example.com, and will be treated as a guest on example.com - this would just create one new instance where a user might think he got logged out. That's why I'm not in favour of adjusting the livesite dynamically in 1.0.x. I'd rather get the login issues fixed, and leave the livesite settings alone (except for the https switchover which will probably make it into 1.0.12).

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 8:38 pm
by davemacd
Tried that too - didn't fix my problem when running under IIS I'm afraid  :(

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 8:41 pm
by mcsmom
Maybe I am just very consistent in my hard coded links, but I haven't noticed this problem.

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 8:47 pm
by friesengeist
davemacd wrote: The only fix I can find that works is either ticking the remember me box or checking the login message parameter on the login module which says "You are now logged in". These work - but aren't great solutions !
Interesting find, the thing about the login message.

I don't have access to IIS, and found out that it's not within the MSDN Academic Alliance, from where I thought I could get it.
I'll take a look at it this weekend and ask some of the other devs to test this on IIS. I've seen some interesting posts about redirection, cookies and IIS somewhere, just need to digg it up ;)

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 8:50 pm
by davemacd
Thanks, much appreciated.

For now I am using the login message and it's working round the problem so no massive hurry  ;)

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 8:51 pm
by friesengeist
mcsmom wrote: Maybe I am just very consistent in my hard coded links, ...
That's a good thing. I never write the domain name into the links, but have the SEF-URL-Mambot run on it, so that it will use the live_site when converting the link to the SEF-version.
mcsmom wrote: ... but I haven't noticed this problem.
Try this to simulate the bahviour I'm describing:
Clear all cookies, log in on http://www.yourdomain.com, and go to yourdomain.com afterwards. You should find out that Joomla! treats you as a guest...

Re: Proposed Solution: Double Login Issues

Posted: Wed Oct 25, 2006 9:04 pm
by Beat
friesengeist wrote:
unixboymd wrote: What about adding the following to the configuration.php file? I've found that this fixes the whole issue of sites being accessed from http://www.domain.com or domain.com.

Code: Select all

$mosConfig_live_site = 'http://' . $_SERVER['HTTP_HOST'];
Joomla! 1.5 is doing something quite similiar - no mosConfig_live_site anymore. I doubt it though that this will change for 1.0.x - it changes behavior, and is probably out of scope of a stability release. I can also see one problem arise from this change: let's imagine your users log in on http://www.example.com. Now lets assume you have a hardcoded Link in your content to example.com/index.php?whatever. The user logged in on http://www.example.com, and will be treated as a guest on example.com - this would just create one new instance where a user might think he got logged out. That's why I'm not in favour of adjusting the livesite dynamically in 1.0.x. I'd rather get the login issues fixed, and leave the livesite settings alone (except for the https switchover which will probably make it into 1.0.12).
livesite setting needs to stay in 1.0.12, agreeing.

i would rather have joomla redirecting to the correct site automatically in case of an alias site than removing the livesite.
friesengeist wrote: Try this to simulate the bahviour I'm describing:
Clear all cookies, log in on http://www.yourdomain.com, and go to yourdomain.com afterwards. You should find out that Joomla! treats you as a guest...
That's absolutely normal: for cookies, these are two different sites, and browsers don't allow cookies to spread.

Thus, the only cure is redirecting in case of wrong site, either in the dot htacceess file or in joomla itself ;)

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 1:44 pm
by MrRoyce
Ok..go slow for a newbie. 

From what I can gather from this thread, there are 3 proposed solutions to the issue. 

- Overwriting the files as in the original post by friesengeist
- changing .htaccess as suggested by shumisha
- changing the configuration.php as suggested by unixboymd.

Is there any kind of consensus?  ???

I've been using Joomla for all of about a month or so and reading some of these threads can get kind of confusing!  :-[

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 1:50 pm
by TheWagner
Agreed. I'm still  lost on the best solution and I can't get the dot htaccess change to solve the problem.
I added the code, and when I go to domain.com it does not automatically take me to http://www.mydomain.com.

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 3:35 pm
by ks_tiwari
Me too....so which one is the best solution it ... ???

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 6:07 pm
by boppinbob
Enno's solution works for me. Just need to back up before patching production site.

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 6:16 pm
by friesengeist
MrRoyce wrote: Ok..go slow for a newbie. 

From what I can gather from this thread, there are 3 proposed solutions to the issue. 

- Overwriting the files as in the original post by friesengeist
- changing .htaccess as suggested by shumisha
- changing the configuration.php as suggested by unixboymd.

Is there any kind of consensus?  ???

I've been using Joomla for all of about a month or so and reading some of these threads can get kind of confusing!  :-[
All three are valid, let me try to explain the differences:
  • The initial post of this thread is meant for getting feedback from users, if it solves all know login issues. So far, I'm satisfied with the results, only Microsoft's Internet Information Server (IIS) still has problems. So something quite similiar to this will probably be used in 1.0.12, I'll discuss some details with Beat in the next days.
  • Changing .htaccess will not work on every server, as a special module (mod_rewrite) needs to be loaded by the server. I have no clue how this would look like in IIS, but I doubt it that you can use a .htaccess (written for Apache) on IIS. So this is indeed a good solution, but not really within the scope of Joomla!, as it depends to much on your server config. However, this avoids penalties for duplicate content from search engines, as your content can only be found under one doamin - so it's basically a good thing.
  • Changing the configuration.php (or achieving the same thing in any other file) is IMHO out of scope for 1.0.12, as stated earlier by me.
So it's your choice, use what ever solves the issues for you :)

BTW, thanks to everyone who tested the patch! Let me hear if there is anyone for whom this is not working (except for IIS).

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 10:36 pm
by jave
i have jommla 1.0.8 and the patch will ot work.
can you give me a help with this version?

Re: Proposed Solution: Double Login Issues

Posted: Thu Oct 26, 2006 11:00 pm
by technopuzzle
Upgrading to the latest and greatest release of Joomla not only fixes bugs but also helps keep your site secure.
jave wrote: i have jommla 1.0.8 and the patch will ot work.
can you give me a help with this version?

Re: Proposed Solution: Double Login Issues

Posted: Fri Oct 27, 2006 6:12 am
by RobS
To reinforce Enno's last post. 

This topic of this thread is on feedback for the proposed solution.  Let's stay on this topic please.

Thanks.

Re: Proposed Solution: Double Login Issues

Posted: Fri Oct 27, 2006 7:10 pm
by mcsmom
ry this to simulate the bahviour I'm describing:
Clear all cookies, log in on http://www.yourdomain.com, and go to yourdomain.com afterwards. You should find out that Joomla! treats you as a guest...
That's a different issue, but it is okay if you log in as one or the other since the above solution solves the javascript problems that come from www v. non www.

Re: Proposed Solution: Double Login Issues

Posted: Fri Oct 27, 2006 8:56 pm
by BrianDW
ok,i installed 1.0.11,registered my self as a regular member( i have a seperate login for admin).would try to log in and it shows as having one guest online,go to admin,shows my user as registered and such but not logged in.i tried the 2 file overwrites and still the same problem.and yes the log in is from the same IP as backend.tried from another PC in the house with same results. this might be why i couldnt get Community Builder to work for me as well.any help is appreciated.
Brian