For those that are interested, a temporary work-around that does not
require editing tools.py is to put this in your db.py:
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.verify_email_onvalidation = login_email_lower
On Apr 26, 12:34 pm, mdipierro <[email protected]> wrote:
> I will look into this.
>
> On Apr 25, 7:26 pm, Russell <[email protected]> wrote:
>
> > Okay, I've thought more about this and can see why you might want to
> > overwrite the validators...you don't want IS_NOT_IN_DB(db,
> > auth_table.email) validation on login! So maybe just a case-sensitive
> > flag?
>
> > On Apr 26, 12:01 pm, Russell <[email protected]> wrote:
>
> > > Hi,
>
> > > Auth.login overwrites any custom email validators that you define.
> > > Specifically, line 1019 of tools.py overwrites
> > > table_user[username].requires with
> > > IS_EMAIL(error_message=self.messages.invalid_email). Why is this
> > > necessary? For example, it means that this does NOT work:
>
> > > db.py
> > > -----
> > > auth_table = db.define_table(
> > > auth.settings.table_user_name,
> > > Field('email', length=128, default='',
> > > unique=True, writable=True),
> > > ...)
>
> > > auth_table.email.requires = [
> > > IS_LOWER(),
> > > IS_EMAIL(error_message=auth.messages.invalid_email)]
>
> > > Email must be case-sensitive?! Anyway, I suggest the following patch
> > > to tools.py:
>
> > > Replace:
> > > 1019 table_user[username].requires = tmpvalidator
> > > With:
> > > 1019 table_user[username].requires = table_user[username].requires or
> > > tmpvalidator
>
> > > Or if you consider this a feature, perhaps a new setting?
> > > 1019 if not self.settings.login_email_custom_validators:
> > > table_user[username].requires = tmpvalidator
>
> > > Thanks
> > > Russell
>
> > > --
> > > Subscription
> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en