Exactly where is auth being defined -- is it in /app/models/db.py, or is it 
in a subfolder of /app/models?
 
Note, if you're using the current version of web2py, you no longer need to 
pass globals() to auth, so just do auth=Auth(db).
 
Also, for API details, see http://web2py.com/book/default/chapter/04#API and 
http://www.web2py.com/examples/static/epydoc/index.html.
 
Anthony

On Tuesday, July 5, 2011 4:58:57 PM UTC-4, beedge wrote:

> 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