[SOLVED] Unable to login

photohenning

Joined: 2008-04-02
Posts: 10
Posted: Wed, 2008-04-02 00:29


Gallery version (not just "2"): 2.2.4
PHP version (e.g. 5.1.6): 4.4.2-1.1
PHPInfo Link (see FAQ): http://xn--klokkersen-75a.com/phpinfo.php
Webserver (e.g. Apache 1.3.33): Apache X.Y.Z.
Database (e.g. MySql 5.0.32): MySQL 4.0.24
Activated toolkits (e.g. NetPbm, GD): all except Dynamic Albums, Keyword Albums, Thumbnail Manager, Rating (these four failed on installation), Migration and all Commerce modules
Operating system (e.g. Linux): Linux
Browser (e.g. Firefox 2.0): Firefox 2.0.0.13, IE 6.9.2900

I have installed Gallery 2, file integrity and everything else checked out OK.

But login does not work. I enter the correct username and password (I know these are OK) and hit the Login button. That takes me back to whatever page I came from (e.g. main.php). There is no error message, I just don't get logged in.

Two possible error sources that I can think of: 1. My domain uses IDN (internationalized domain names) 2. my web hosting uses PHP as CGI (cgi-bin/php-fcgi-starter).

There is however no change in behaviour if I override $gallery->setConfig('baseUri', ''); with the proper variable.

Another thing I found is that initially, the login page does not have a captcha form. If I try to login with a usr/pwd that does not exist, I get the "Your login information is incorrect. Please try again." and there's a captcha form. However, it doesn't help if I use captcha.

Could it be that session doesn't work? I tried to find a unit test to test session (after reading about it in the forums) but there are no unit tests in my lib/tools folder.

I have searched the forums, but cannot find a solution to my problem.

Please help!

Attachments: debug log with captcha, debug log without captcha

AttachmentSize
debug log with captcha.txt15.57 KB
debug log without captcha.txt15.57 KB
 
analogic

Joined: 2008-04-02
Posts: 1
Posted: Wed, 2008-04-02 05:46

Same exact problem. I'm not a Linux user and pay for hosting so I have very little control. I get the same main.php page after a known correct login.
2.2.4 upgraded from 2.0
No data in the file/ brand new setup.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2008-04-02 13:11

> There is however no change in behaviour if I override $gallery->setConfig('baseUri', ''); with the proper variable.

leave baseUri empty. if it's not empty and you enter the wrong value (e.g. not ending on main.php without changing the webserver's directoryindex), then we'd expect this behavior: login fails because the login credentials aren't submitted to gallery correctly.

please remove your baseUri again, and post a link to your gallery.

also see:
FAQ: I can't login anymore, what can I do now?

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Wed, 2008-04-02 14:14
valiant wrote:
>
please remove your baseUri again, and post a link to your gallery.

baseUri removed. Link: http://xn--klokkersen-75a.com/gallery2

I have read it, but it doesn't help. I don't get any of the four error messages (i don't get an error message at all), i haven't upgraded, i haven't changed any cookie path / domain settings, and I don't use an older version than 2.0 RC-1 with G2 on IIS.

I have also manually deactivated the captcha module and tried logging in againg, but no change in behaviour. Thanks so far but I still need more help!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2008-04-02 14:39

@IDN:
if you use http://xn--klokkersen-75a.com/gallery2 it really shouldn't make any difference. if you use international characters, there could be a problem since we haven't tested that before I guess.

so i've forced your gallery to send me a cookie and the cookie values look fine. of course i couldn't try the login process since i have no account on your website.
sessions work fine in your g2. i forced my session to be in German and it sticked, based on the cookie / persistent session that your g2 created for me.

please clear your browser's cookies and try again. i can't do more than that without a login to your gallery. with a login account i could try to login from here, check the http headers etc.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Wed, 2008-04-02 14:42

edit by forum moderator: never ever post your g2 admin accounts in public. one can do a lot of bad things with admin access.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2008-04-02 14:55

please put your gallery into "buffered" debug mode.
see: FAQ: How to set/use Gallery in debug mode?

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Wed, 2008-04-02 15:32

*Done

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2008-04-02 15:44

looks all fine...but g2 decides not to use the persistent session for some reason.
criteria that could mismatch are session expiration/lifetime, remote-identifier (IP + useragent string).

so...more debugging is needed. you'll have to debug your session manually, editing modules/core/classes/GallerySession.class to add more debug statements.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Wed, 2008-04-02 16:25

Hmm... could you point me to the lines where I can add more debug statements?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2008-04-02 16:49

first check the the _loadSession() call where it loads the data from the db and asserts the session expiration / lifetime.
line 865:
http://fisheye3.cenqua.com/browse/gallery/trunk/gallery2/modules/core/classes/GallerySession.class?r=16622#l865

and if that returns correctly, check if the remote identifier (user agent / ip) match:
line 231:
http://fisheye3.cenqua.com/browse/gallery/trunk/gallery2/modules/core/classes/GallerySession.class?r=16622#l231

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Thu, 2008-04-03 09:02

I've added some echo's to see what happens in the two code chunks after the two lines you mention. Not that I got anything out of it, but maybe it tells you something?

I've attached the changed GallerySession.class, all lines I've added are marked with "//DEBUGGING" at the end.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2008-04-03 20:20

- you should use $gallery->debug('your message here'); instead of echo. if you use echo, cookies don't work anymore since you start outputting before g2 sends the http headers to set / update a cookie.

- the "echo '<h1>$this->_isPersistent equals to false.</h1>';//" comment is at the wrong place. it needs to be and else to the outer if condition.

anyhow, it looks all fine...just that you're not logged in.

please run the following database query:
delete from g2_FactoryMap where g_implModuleId = 'httpauth';
(once you can login as admin again, please uninstall the http-auth module in site admin -> plugin to cleanup the small inconsistency we introduce hereby)

then clear your db cache with lib/support/
see: FAQ: How can I clear cached data?

and remove your echo statements (or change them to $gallery->debug('bla bla');).

if that helps, good. if not, let's debug function GalleryInitSecondPass() in init.inc.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Thu, 2008-04-03 21:36
Quote:
you should use $gallery->debug('your message here')

Done.

Quote:
the "echo '<h1>$this->_isPersistent equals to false.</h1>';//" comment is at the wrong place.

Done.

Quote:
please run the following database query:

Done. Result:

Quote:
Slettede rader: 2 (Spørring tok 0.0162 sek)
SQL-spørring:
DELETE FROM g2_FactoryMap WHERE g_implModuleId = 'httpauth'

Quote:
then clear your db cache with lib/support/

Done. Result:

Quote:
Successfully deleted page cache
Deleting dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/entity
Recreating dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/entity
Deleting dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/module
Recreating dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/module
Deleting dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/theme
Recreating dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/theme
Deleting dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/smarty/templates_c
Recreating dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/smarty/templates_c
Deleting dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/tmp
Recreating dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/tmp
Deleting dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/repository
Recreating dir: /var/www/01/34/49/xn--klokkersen-75a.com/www/gallery2/g2data_rndstr/cache/repository
Removed 0 install/upgrade log files

Unfortunately, still doesn't work...

I've added debug lines to GalleryInitSecondPass() in init.inc (see attachment). Let me know if there's anything else I should do. Thanks for the help so far...

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2008-04-03 21:46

in init.inc, after list ($ret, $user) = $plugin->getUser(); add:
$gallery->debug('User from auth plugin:');
$gallery->debug_r((array)$user);

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Thu, 2008-04-03 21:47

When I try it now, I get:

Quote:
GalleryInitSecondPass() | $ret was never set, this is the end of the function. $gallery->setActiveUser($user) and the function returns null

so it seems like the user is never set from the "registered authentication plugins", maybe that's what's wrong? And is there a solution?

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Thu, 2008-04-03 21:58
Quote:
in init.inc, after list ($ret, $user) = $plugin->getUser(); add:
$gallery->debug('User from auth plugin:');
$gallery->debug_r((array)$user);

Done.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2008-04-03 23:46

ok, it seems you somehow managed to get the default auth plugin out of the database.
let's verify that theory. please report the results of the following db query:

SELECT * FROM g2_FactoryMap g where g_classType = 'GalleryAuthPlugin';

if it reports 0 results for that query, please run the following query to fix the problem:

insert into g2_FactoryMap (g_classType, g_className, g_implId, g_implPath, g_implModuleId, g_hints, g_orderWeight) values ('GalleryAuthPlugin', 'SessionAuthPlugin', 'SessionAuthPlugin', 'modules/core/classes/GallerySession.class', 'core', '', '4');

and then clear the db cache again (lib/support/), FAQ: How can I clear cached data?
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
photohenning

Joined: 2008-04-02
Posts: 10
Posted: Fri, 2008-04-04 00:09
Quote:
SELECT * FROM g2_factorymap g where g_classType = 'GalleryAuthPlugin';

Returned 0 results.

Quote:
insert into g2_FactoryMap (g_classType, g_className, g_implId, g_implPath, g_implModuleId, g_hints, g_orderWeight) values ('GalleryAuthPlugin', 'SessionAuthPlugin', 'SessionAuthPlugin', 'modules/core/classes/GallerySession.class', 'core', '', '4');

1 inserted rows.

Quote:
and then clear the db cache again (lib/support/),

OK.

YES! That did it!

I don't know when and how I lost the default auth plugin. I did install, delete and reinstall g2 once or twice, so probably it disappeared somewhere in that process.

Thanks a lot for the help valiant!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2008-04-04 00:29

i'm glad your gallery is working again. i've seen this issue (no default auth plugin in database) a few times now. i still have no idea how one gets the database into this state though.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage