HC thanks that worked like a charm. I must confess I think this
should be a bit more straightforward and I woiuld not have figured out
the separate places I needed to manipulate a users email address to
make this work. For others who may encounter this need here is a
consolidated summary of ensuring email matches across the built in
registration and login features of web2py:
1) add in a constraint to the email filed of auth.users by using a
requires (requires=IS_LOWER(),IS_EMAIL() ) . This ensures the email
is stored in lower case during registration and profile update.
2) defining a validation function that converts an email address to
lower case. (and knowing that it needed to receive a form as a
parameter,and it was possible to change the values of the submitted
form)
# setup conversion of email address to lower case upon
clogin
def email_to_lower(form):
form.vars.email = form.vars.email.lower()
3) hooking the function defined in step 2 to be called after login and
changing the case of the email the user entered to lowercase (this
ensures it will match and make a better experience for the user).
This is done as follows:
auth.settings.login_onvalidation = email_to_lower
On Sep 18, 5:28 am, hcvst <[email protected]> wrote:
> Hi David,
>
> somehow, doesn't look pretty but this works.
>
> def email_to_lower(form):
> form.vars.email = form.vars.email.lower()
>
> auth.settings.login_onvalidation = email_to_lower
>
> I guess the login form should not be case sensitive. (Or should it,
> Massimo?)
>
> Regards,
> HC