Thanks,
Jim
First off, I'd like to tell you how much I love the web2py framework!
Thanks for the time and effort, it was well worth it!
Now to my issue:
I'm just not getting it. I added
auth.messages.registration_successful = 'some string' to my db.py
model but I'm not sure what it is that I need to do get the message to
display on my view after registering a new account. The example that
was given stated that 'Views are handled the usual web2py way' which I
assume to mean that I need to pass the text from the controller to the
view. But I'm a bit fuzzy on what the 'messages' objects actually
do. If there's some documentation on this, please point me to it. If
not, a brief explanation would be appreciated.
Thanks again,
Jim
thanks for your comments.
Assuming you are registering using the default user() action,
depending on your settings
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
web2py should display one of the following messages:
auth.messages.unable_send_email
auth.messages.email_sent
auth.messages.registration_pending
auth.messages.registration_successful
How does your auth.settings look like?
This is probably more detail than you need but it's easier to send it
all once than going back and forth over specific lines of code:
from gluon.tools import *
auth=Auth(globals(),db)
auth_table=db.define_table(
'person',
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True),
Field('password', 'password', length=128, readable=False,
label='Password'),
Field('registration_key', length=128, default= '', writable=False,
readable=False),
Field('company_name', length=128, default=''),
Field('account_name', length=30, default=''),
Field('accepts_eula', 'boolean'),
Field('offer_code', length=50, default=''),
Field('referral_code', length=50, default=''),
Field('server', length=10, default='web01'),
Field('htaccess', default='')
)
auth_table.first_name.requires=[
IS_NOT_EMPTY(error_message=auth.messages.is_empty),
IS_ALPHANUMERIC()]
auth_table.last_name.requires=[
IS_NOT_EMPTY(error_message=auth.messages.is_empty),
IS_ALPHANUMERIC()]
auth_table.password.requires=[IS_STRONG(),CRYPT()]
auth_table.email.requires=[
IS_EMAIL(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB(db, auth_table.email)]
auth_table.account_name.requires=[
IS_NOT_EMPTY(error_message=auth.messages.is_empty),
IS_ALPHANUMERIC(),
IS_NOT_IN_DB(db, auth_table.account_name, error_message='That
account name is not available')]
auth_table.accepts_eula.requires=[
IS_NOT_EMPTY(error_message='You must accept the terms of use to
register'),
IS_MATCH('[on]', error_message='You must accept the terms of use to
register')]
auth.settings.table_user_name='person'
auth.settings.hmac_key='<some key>'
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.table_user=auth_table
auth.settings.register_next = URL(r=request, c='default', f='account')
auth.settings.logged_url = URL(r=request, c='default', f='account')
auth.settings.login_next = URL(r=request, c='default', f='account')
auth.settings.logout_next = URL(r=request, c='default', f='index')
auth.settings.retrieve_username_next = URL(r=request, c='default',
f='user', a='login')
auth.settings.retrieve_password_next = URL(r=request, c='default',
f='user', a='login')
auth.settings.change_password_next = URL(r=request, c='default',
f='account')
auth.messages.registration_successful = 'Registration successful'
auth.define_tables()
crud=Crud(globals(),db)
service=Service(globals())
# crud.settings.auth=auth
if auth.is_logged_in():
USERID = auth.user.id
else:
USERID = None
Also, I'm using Version 1.74.4 (2009-12-23 10:12:11).
auth.settings.registration_requires_verification = True
the user is automatically logged in after registration so the login
flash overrides the registration flash.
If you change the above setting, users will get the registration flash
"email sent" which is the one you probably you want to edit.
Massimo
After I finish my project and verify that all of the parts are in
working order, I'll package a couple things up as modules or plugins
to share with the community. I'm working on a PayPal IPN verification
system with a way of handling PayPal subscription payments. I'm also
building a secure way of communicating from one web2py app to another
on different machines (e.g. app1 is the master that sends commands to
app2).
Thanks for the help!
Jim