From 09c8b5ecedca4926c978ad4f5a93071b2ba9abb2 Mon Sep 17 00:00:00 2001 From: Mirko Galimberti Date: Fri, 7 Sep 2018 10:23:07 +0200 Subject: [PATCH] skip requires on custom userfield --- gluon/tools.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gluon/tools.py b/gluon/tools.py index 16d6ce2b..0910b6c4 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -3456,12 +3456,12 @@ class Auth(AuthAPI): error_message=self.messages.invalid_email)] if not self.settings.email_case_sensitive: table_user.email.requires.insert(0, IS_LOWER()) - else: - table_user[userfield].requires = [ - IS_IN_DB(self.db, table_user[userfield], + elif userfield == 'username': + table_user.username.requires = [ + IS_IN_DB(self.db, table_user.username, error_message=self.messages.invalid_username)] if not self.settings.username_case_sensitive: - table_user[userfield].requires.insert(0, IS_LOWER()) + table_user.username.requires.insert(0, IS_LOWER()) form = SQLFORM(table_user, fields=[userfield],