hi,

is it possible to put signature on custom auth table?
e.g. taken from book

## after auth = Auth(db)
db.define_table(
    auth.settings.table_user_name,
    Field('name', length=128, default=''),
    Field('email', length=128, default='', unique=True), # required
    Field('username', length=128, default='', unique=True),
    Field('password', 'password', length=512,            # required
          readable=False, label='Password'),
    Field('address'),
    Field('city'),
    Field('zip'),
    Field('phone'),
    Field('registration_key', length=512,                # required
          writable=False, readable=False, default=''),
    Field('reset_password_key', length=512,              # required
          writable=False, readable=False, default=''),
    Field('registration_id', length=512,                 # required
          writable=False, readable=False, default=''), 
    Field('is_active', 'boolean', default=True),
    Field('created_on', 'datetime', default=request.now),
    Field('updated_on', 'datetime', update=request.now) )

## do not forget validators
custom_auth_table = db[auth.settings.table_user_name] # get the 
custom_auth_table
custom_auth_table.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)]
custom_auth_table.username.requires = IS_NOT_IN_DB(db, 
custom_auth_table.username)

auth.settings.table_user = custom_auth_table # tell auth to use 
custom_auth_table

## before auth.define_tables()

auth.define_tables(username=True, signature=True)

this one is work, my question is 
1. why auth.define_tables(username=True, signature=True) is not work when i 
redefine the auth_user? (i must explicit put the username field and 
signature on the table definition)
2. how can i put the created_on and modified_on in the example above?
tried :
Field('created_by', auth.settings.table_user_name), 
or
Field('created_by', db.auth_user),

it returns an error.

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to