I have a question related to "*auth_user*" table. So far I was under 
impression "*email*" field is a unique field where no two rows can have the 
same "email". But with a use case I tried and have described below I ended 
up with 2 rows in "auth_user" with same email !

My app and the use case:

1. I have Janrain RPX login enabled so that a user can use, say Gmail 
account (exam...@gmail.com).

2. I later tried to integrate Gmail SMTP auth using below code

from gluon.contrib.login_methods.email_auth import email_auth

auth.settings.login_methods.append( email_auth("smtp.gmail.com:587", "@
gmail.com"))


3. I first use Janrain RPX way to login and it is successful, and a row is 
added to "auth_user" with "*registration_id*" field set to something like "
https://www.google.com/profiles/xxx"; and the*auth_user.password* is empty.

4. Next I use the normal login form to login with my gmail accont directly, 
for "exam...@gmail.com" account and it is successful too with "
smtp.gmail.com" authentication. And this added another row with same email (
exam...@gmail.com) to *auth_user* and with a hash of the password stored in 
*auth_user.password field*.


I next tried to manually add a row using the database admin to see if 
duplicate emails are indeed accepted but it gave error saying it is not 
allowed. I was trying to see where the "email" and other default fields are 
defined and if there is a way to enforce unique/primary key type constraint 
to "email" field?

Would like to know if someone else has seen this issue? And any way to 
handle the above scenario where we have only 1 record in auth_user table?

Thanks,
Srini

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to