In Models file "db.py":
where is:
auth.define_tables(username=False, signature=False)
Change to:
auth.define_tables(username=True, signature=False)
In Controller file "default.py":
def user(): if 'login' in request.args: db.auth_user.username.label = T("Username or Email") auth.settings.login_userfield = 'username' if request.vars.username and not IS_EMAIL()(request.vars.username)[1]: auth.settings.login_userfield = 'email' request.vars.email = request.vars.username request.post_vars.email = request.vars.email request.vars.username = None request.post_vars.username = None return dict(form=auth()) return dict(form=auth())
Voilá! Now you can login using the username or email
Comments (0)