hi, thank you for your help.
I tried that with the following code (based on gluon/tools.py - method
define_tables) that intended to make to make the "last_name" field optional
instead of mandatory. Btw, parallel to what I want to show, I believe this
example could be used as proof of concept on how to customize the
authentication in AlterEgo (unless there is an easier way to do it...).
Anyway, to the code:

from gluon.tools import Mail, Auth, Recaptcha db=SQLDB("sqlite://test.db")
mail=Mail() ## specify your SMTP server mail.settings.server = '
smtp.yourdomain.com:25' ## specify your email address mail.settings.sender =
'y...@yourdomain.com' ## optional: specify the username and password for SMTP
mail.settings.login = 'usern...@password' ## instantiate the Auth class (or
your derived class) auth = Auth(globals(), db) auth.settings.table_user=
db.define_table( auth.settings.table_user_name, db.Field('first_name'),
db.Field('optional_last_name'), db.Field('email'), db.Field('password',
'password', readable=False), db.Field('registration_key', writable=False,
readable=False), ) auth.settings.table_user.first_name.requires =
IS_NOT_EMPTY() auth.settings.table_user.password.requires = CRYPT()
auth.settings.table_user.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db,
'%s.email' % auth.settings.table_user._tablename)]
auth.settings.table_user.registration_key.default = '' ## ask it to create
all necessary tables auth.define_tables()
====================
This code fails to work. I sneak into the web2py's source code and found out
what I believe to be the source of the problem. There is a bug when handling
manual defined user tables. It's just an indentation issue that makes a part
of the default table_user code to be executed (even if you define it
manually). I also found this bugs repeated in all other tables like this.
This patch intends to fix all the bugs of this type to (really) allow manual
customization of the authentication tables.

Thank you

Massimo said:
>
before

auth.define_tables()

you can do

auth.settings.table_user=....

to point it to your own user table with more fields.

Massimo


-- 
Francisco Gama

E-mail: blacktho...@ironik.org
MSN: blacktho...@ironik.org
ICQ: 58040653
Google Talk: francisco....@gmail.com
Skype: francisco_gtr
Cell phone: +351 934420305

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: manual_auth_tables.patch
Description: Binary data

Reply via email to