Hi.  N00b and presumably doing something stupid.

Picked the below up from the book and dropped into my own model file in my 
own Application.  All good except the auth tables aren't exposed in 
Appadmin.  This is a problem at the moment because I'm playing around with 
authentication to see what it does and have set up some usernames I want to 
clear out.  The  Welcome App is still in there, and auth tables are exposed 
in there.  Presumably, I'm missing some setting which I require when I 
define an alternative auth table, but having gone through the book, its not 
clear to me what that is.

Also, if there is a simple spec of objects (methods, attributes etc) 
somewhere could someone point me at it?  Thanks.

# after
# auth = Auth(globals(),db)
db.define_table(
    auth.settings.table_user_name,
    Field('first_name', length=128, default=''),
    Field('last_name', length=128, default=''),
    Field('locality', 'string', length=20, requires=IS_IN_SET(['East','North 
& Central','South'])),
    Field('manager', 'string', length=30, requires=IS_IN_SET(['Ruth 
Gilpin','Marie Malferiol-Force','Jeannie Osmond','Ruth Staples'])),
    Field('email', length=128, default='', unique=True),
    Field('password', 'password', length=512,
          readable=False, label='Password'),
    Field('registration_key', length=512,
          writable=False, readable=False, default=''),
    Field('reset_password_key', length=512,
          writable=False, readable=False, default=''),
    Field('registration_id', length=512,
          writable=False, readable=False, default=''))

custom_auth_table = db[auth.settings.table_user_name] # get the 
custom_auth_table
custom_auth_table.first_name.requires = \
  IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.last_name.requires = \
  IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.password.requires = [IS_STRONG(), CRYPT()]
custom_auth_table.email.requires = [
  IS_EMAIL(error_message=auth.messages.invalid_email),
  IS_NOT_IN_DB(db, custom_auth_table.email)]

auth.settings.table_user = custom_auth_table # tell auth to use 
custom_auth_table
# before
# auth.define_tables()

Reply via email to