Just found out that adding following setting will solve the "register duplicated accounts" problem. auth.settings.table_user.email.requires.insert(0,IS_LOWER())
But request_reset_password still didn't work well. Still treat "[email protected]" as an unknown email. In the gluon.tools, I found following code in the request_reset_password() function: table_user.email.requires = [ IS_EMAIL(error_message=self.messages.invalid_email), IS_IN_DB(self.db, table_user.email, error_message=self.messages.invalid_email)] This code overrides the customized email settings such as IS_LOWER(). I hope this code should be changed to allow customized email settings. Just opened a ticket for it: http://code.google.com/p/web2py/issues/detail?id=1212 Thanks On Thursday, November 29, 2012 1:30:54 PM UTC-5, Mark wrote: > > I do following for case insensitive email login (on 2.2.1): > > def login_email_lower(form): > form.vars.email = form.vars.email.lower() > return form > auth.settings.login_onvalidation = login_email_lower > auth.settings.register_onvalidation = login_email_lower > auth.settings.profile_onvalidation = login_email_lower > auth.settings.retrieve_password_onvalidation = login_email_lower > auth.settings.reset_password_onvalidation = login_email_lower > > It works fine for login. But I am able to register duplicated accounts > such as "[email protected]" and "[email protected]" (both are "[email protected]" > in database). Also, if I want to reset password for "[email protected]", I > get "Invalid email" error. > > The login_onvalidation works well. But register_onvalidation > and reset_password_onvalidation are too late to lower case. Need to lower > case before validation, but how can login_onvalidation work > but register_onvalidation not? Is this a bug or are there better ways to > implement case insensitive email? > > Thanks, > Mark > --

