Are you storing the email address in both the "username" field and the "email" field?
On Tuesday, April 8, 2014 11:47:05 AM UTC-4, Ray (a.k.a. Iceberg) wrote: > > Thanks for the response. BTW I am trying to change my system from username > login to email login, AND at the same time I want those old (existing) > users to continue using username to login. So I end up using username, but > with a IS_EMAIL() validator. Is there any side effect for that? > > Anthony <[email protected]> wrote: > > Yes, seems like a bug. I guess no one uses this setting (probably because > it's not documented). > > Anthony > > On Sunday, April 6, 2014 3:02:41 PM UTC-4, Ray (a.k.a. Iceberg) wrote: > >> >> >> On Sunday, April 6, 2014 12:03:59 AM UTC-7, Ray (a.k.a. Iceberg) wrote: >>> >>> Just want to double confirm. >>> >>> 1. I found many following lines in tools.py: >>> >>> userfield = self.settings.login_userfield or 'username' \ >>> if 'username' in table_user.fields else 'email' >>> >>> it means: >>> >>> if 'username' in table_user.fields: >>> userfield = self.settings.login_userfield or 'username' >>> else: >>> userfield = 'email >>> >>> >>> 2. If we used a slightly different source code like this: >>> >>> userfield = self.settings.login_userfield or ('username' >>> if 'username' in table_user.fields else 'email') >>> >>> it means something quite different: >>> >>> if self.settings.login_userfield: # if user explicitly define >>> the login_userfield >>> userfield = self.settings.login_userfield # then use it >>> unconditionally >>> else: # otherwise automatically determine one >>> userfield = 'username' if 'username' in table_user.fields >>> else 'email' >>> >>> >>> So, to double confirm, what is the design purpose of >>> auth.settings.login_userfield? If it is #1, I recommend to use a pair of >>> brackets to avoid misunderstanding. >>> >>> userfield = (self.settings.login_userfield or 'username' >>> ) if 'username' in table_user.fields else 'email' >>> >>> >> Well, now I believe the #2 purpose is the design intention, based on this >> section in Auth.register(): >> >> table_user = self.table_user() >> if self.settings.login_userfield: >> username = self.settings.login_userfield >> elif 'username' in table_user.fields: >> username = 'username' >> else: >> username = 'email' >> >> In this case, I believe #1 is a bug and need to be fixed. >> > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/wZhiUboCRLw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

