Here is the above code in a file so that you don't lose indentation :)
--
Francisco Gama
E-mail: [email protected]
MSN: [email protected]
ICQ: 58040653
Google Talk: [email protected]
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---
from gluon.tools import Mail, Auth, Recaptcha
db=SQLDB("sqlite://test.db")
import datetime
mail=Mail()
## specify your SMTP server
mail.settings.server = 'smtp.yourdomain.com:25'
## specify your email address
mail.settings.sender = '[email protected]'
## 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),
)
#table = auth.settings.table_user.first_name.requires = IS_NOT_EMPTY()
auth.settings.table_user.first_name.requires = IS_NOT_EMPTY()
#table.first_name.requires = IS_NOT_EMPTY()
#table.last_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()
## optional: require email verification for registration
# auth.settings.mailer = mail
## optional: if you require captcha verification for registration
#auth.settings.captcha = Recaptcha(request,public_key='RECAPTCHA_PUBLIC_KEY',private_key='RECAPTCHA_PRIVATE_KEY')