sfDoctrineGuard username is case sensitive?

Ask help about existing plugins, or find advice about the way to build up your own.

Moderators: dwhittle, Ian

sfDoctrineGuard username is case sensitive?

Postby myuser » Sat Oct 16, 2010 8:57 pm

I tried registering a couple accounts with this plugin and found something strange.

Created account 1 with username: myuser
Created account 2 with username: Myuser

And sfGuard had no problem with this. I have found most sites with user accounts do not have case sensitive usernames.
Has anyone else tried this and found this to be a problem?

[glow]Thanks![/glow]
Last edited by myuser on Sat Oct 16, 2010 9:24 pm, edited 1 time in total.
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am

Re: sfDoctrineGuard username is case sensitive??

Postby myuser » Sat Oct 16, 2010 9:21 pm

I replied again because I changed the subject of this post to make it more clear.

Is anyone else experiencing this case sensitive problem?
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am

Re: sfDoctrineGuard username is case sensitive?

Postby maastermedia » Sun Oct 17, 2010 2:45 am

Yes, you are correct. Usernames should definitely be case insensitive. Obviously sfDoctrineGuardPlugin manages usernames case sensitively by default. Nevertheless you can always overwrite setUsername and checkPassword methods according to your needs. Check:
http://trac.symfony-project.org/browser ... .class.php

You have an option to create your own callable when checking password and setUsername method of model can be overwritten in your project model - sfGuardUser.
User avatar
maastermedia
Senior Member
 
Posts: 196
Joined: Sat Aug 14, 2010 12:51 pm
Location: Slovenia

Re: sfDoctrineGuard username is case sensitive?

Postby myuser » Sun Oct 17, 2010 3:31 am

Thanks for the reply and all the good tips. I will definitely follow your recommendation.

Are you sure this is right? If you are correct this seems to be a massive failure for sfGuard. Registration is case-sensitive, but the login is not case-sensitive.

Here is an example.
1. I register the user "Myuser"
2. Immedately after, I login successfully with the username: myuser

Holy crap this is the same for emails as well.. according to sfguard a@b.com is not the same email as A@b.com which is definitely wrong. I have no idea how this has slipped through the cracks until now?!
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am

Re: sfDoctrineGuard username is case sensitive?

Postby myuser » Sun Oct 17, 2010 4:11 am

This may be a sfApply issue actually. You confirmed what I am saying is true so either way I think this needs more attention. I am going to post this on the list.
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am

Re: sfDoctrineGuard username is case sensitive?

Postby maastermedia » Sun Oct 17, 2010 10:40 am

Sorry obviously I was mistaken! Now I've checked in my installation and registration is case sensitive. Login is case insensitive. This is all good. Check how to retrieve user from database based on username:
http://trac.symfony-project.org/browser ... ss.php#L21

Sorry for confusion.
User avatar
maastermedia
Senior Member
 
Posts: 196
Joined: Sat Aug 14, 2010 12:51 pm
Location: Slovenia

Re: sfDoctrineGuard username is case sensitive?

Postby myuser » Sun Oct 17, 2010 10:59 am

No problem at all, but how is this "all good" they need to match! If registration is case sensitive then login needs to be case sensitive as well.

Don't you agree having these match needs to be the case or else data will become unnormalized?

There can be 1,2,3, 50 different combinations of myuser and only one can login. How is that ok...
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am

Re: sfDoctrineGuard username is case sensitive?

Postby maastermedia » Sun Oct 17, 2010 11:13 am

Well it all depends on your requirements, however in most cases of web application publicly available there must be user friendlyness present. User cannot be bothered by entering exact username at login. This kind of behavior is added value for usability.

Maybe I was not clear with registration. Registration validation does check for username in case insensitive way, so you will never have two equal usernames (myUser and Myuser) in database.
User avatar
maastermedia
Senior Member
 
Posts: 196
Joined: Sat Aug 14, 2010 12:51 pm
Location: Slovenia

Re: sfDoctrineGuard username is case sensitive?

Postby myuser » Sun Oct 17, 2010 11:25 am

Oh ok, So the fact that I can register Myuser then myuser is a problem on my end then. The registration is done by sfDoctrineApply so I take it you have that module installed and can confirm that you cannot register a user called "myuser" and then register another user called "Myuser" right after with success?

Sorry for being this dead horse into the ground. I went bonkers when I was able to register the exact same username and emails just by changing the character case.
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am

Re: sfDoctrineGuard username is case sensitive?

Postby maastermedia » Sun Oct 17, 2010 11:58 am

I didn't check for sfDoctrineApplyPlugin, however I think it should be taken care of, yes.
User avatar
maastermedia
Senior Member
 
Posts: 196
Joined: Sat Aug 14, 2010 12:51 pm
Location: Slovenia

Re: sfDoctrineGuard username is case sensitive?

Postby myuser » Sun Oct 17, 2010 10:39 pm

I apologize for the runaround maastermedia the problem appears to be none other than my own. Believe it or not my schema did not have unique requirements on these fields. oops! I hope there is some way I can help you out in the future. :-P
Symfony 1.4.11
Centos 5.6
(PostgreSQL) 8.3.11
PHP 5.2.13
myuser
Member
 
Posts: 93
Joined: Sat Jul 17, 2010 3:51 am


Return to General plug-ins

Who is online

Users browsing this forum: No registered users and 2 guests