miniBB Support Forums | 16 years on The Web
miniBB ® 


 | Begin | Register | Search | Statistics | File Bank | Manual |
Bugs miniBB Support Forums / Bugs /   

Case insensitive login

Author MartinH
#1 | Posted: 22 Feb 2012 11:26 
I found problem with case insensitive login.
First I set $loginCase=TRUE to enable it.
User is registered e.g as Martin, when I type 'Martin' as user name, login fails. Only 'martin' works.
So I looked into the code in bb_func_login.php and found problem:
when query for non admin user is created, only username for DB column is converted do lowercase, but username entered by user stay as is. Then martin = Martin is not true and no row is returned. So entered username should be converted to lowercase too before query DB.
Is it right?
I use miniBB v3.0 and mySQL database.

Author Paul
Lead Developer
#2 | Posted: 22 Feb 2012 17:35 
I'm not sure if you get this setting de-commented?
No double slashes in front of it?
Have you read the manual to get into its logics?

It absolutely works on my end.
When $loginsCase=FALSE; or not set at all (commented), it will work as case-sensitive login.
When $loginsCase=TRUE; it will work as case-insensitive login (like it's set up here on miniBB forums and like it comes by default). I.e. it's already enabled by default. I'm not sure what you're trying to do :)

Author MartinH
#3 | Posted: 23 Feb 2012 09:45 
Sorry, maybe my description is not so clear :-(
Yes, I read the manual and $loginCase is uncomented and set to TRUE.
Pleas consider this line in bb_func_login.pgg (line 82)
db_simpleSelect(FALSE,$Tu,$dbUserSheme['username'][1].','.$dbUserSheme['user_password'][1],$caseComp1.$dbUserSheme['user name'][1].$caseComp2,'=',$user_usr,'',1)
result is following query
SELECT username, user_password FROM minibb_users WHERE lower(username)=user_usr
So username stored in DB is converted to lower case, but user_usr is exactly what user entered to the form. When I enter 'Martin' to the form, then WHERE condition is martin=Martin and no match is found in DB.

Admin login works correctly becasuse is done different way
if ($user_usr==$admin_usr OR (isset($loginsCase) and $loginsCase and strtolower($user_usr)==strtolower($admin_usr)) )
both sides are converted to lower

BTW: I registered to this forum and only username which work is exactly 'MartinH' (not martinh or MARTINH).
Thank you for a reply and hope that I'm not totally wrong

Author tom322
Active Member
#4 | Posted: 23 Feb 2012 17:29 
WHERE condition is martin=Martin and no match is found in DB.

I think this condition is match. But it's not a professional opinion ;)

Author Paul
Lead Developer
#5 | Posted: 23 Feb 2012 18:52 
Sorry, it seems while testing your report yesterday, I've set $loginsCase=FALSE on miniBB forums and forgot to bring it back.
You may try your login again and it should work.
Please test it and let me know if your login will work now in any case. Then I could give further explanations to the problem.

Author MartinH
#6 | Posted: 24 Feb 2012 08:30 
Yop, it's working now in any case.
No match in my case. But it works on this forum, so somethig must be different. Maybe table collation in DB? Not sure
Thank you for your replies.

Author Paul
Lead Developer
#7 | Posted: 24 Feb 2012 12:11 
Yes, if it works on your end now, it would mean mySQL considers 'martinh' equal to 'MartinH' and probably it's up to some setting or configuration, but I'm not sure, which one exactly.

But I can definitely confirm, that in the mySQL request you have mentioned above, there should be strtolower($user_usr) instead of plain $user_usr comparison. I have fixed bb_func_login.php in the core miniBB package already, to contain the most proper code. Try to update the file on your end and report what happens.

Thanks for mentioning this!

Author MartinH
#8 | Posted: 24 Feb 2012 14:17 | Edited by: MartinH 
Tested on my localhost with fixed bb_func_login.php and it's working correctly. Username can be in any case :-).
Thanks for the fix and fast responses.

Bugs miniBB Support Forums / Bugs /
 Case insensitive login
 Share Topic's Link

This topic is closed. New replies are not allowed.


miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.