As I said in the title I want to accept only specific addresses for sign in on my website.
I try this:
address_in_2_parts=auth.user.email.split("@")
if address_in_2_parts[1]=="domain_i_want.com"
I want to add condition but where I have to add this lines of code ?
You can simply add an additional validator to the email
field of the db.auth_user
table. In the model file where Auth
is defined, after calling auth.define_tables()
, add the following:
db.auth_user.email.requires.append(IS_MATCH(r'.*@domain_i_want\.com$',
error_message='Only domain_i_want.com email addresses allowed.'))