Hi folks, we have one table in database with users wich contains 3 fields,
id, email, password. How can I use Auth object with this table without
creating additional fields like registration_key, registration_id ??
actually I don't want to touch the tables because it's used by other
applications writen in php.
auth.settings.table_user_name = 'sf_login'
db.define_table(
auth.settings.table_user_name,
Field('email', length=128, default='', unique=True), # required
Field('password', 'password', length=512, # required
readable=False, label='Password'),
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=''))
custom_auth_table = db[auth.settings.table_user_name]
custom_auth_table.password.requires = [IS_STRONG()]
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
auth.define_tables(username=False, signature=False)
I tried without them but this seems to be required in order to use Auth
--
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/groups/opt_out.