The problem is that unless you have

   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


On Jan 10, 10:45 pm, JimK <jkel...@gmail.com> wrote:
> After registration, I'm redirected to the account page with a flash
> message stating 'Logged In' instead of my 'Registration Successful' as
> defined below.  I can of course override the Logged In message by
> adding a 'response.flash = auth.messages.registration_successful' but
> then the user will always see that message when they navigate to my
> account page.  I'm sure there's something simple that I'm missing but
> it keeps eluding me.
>
> 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).
>
> On Jan 10, 7:48 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Hi 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?
>
> > On Jan 10, 7:57 pm, JimK <jkel...@gmail.com> wrote:
>
> > > Hello Massimo,
>
> > > 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
>
> > > On Jan 10, 5:55 am, Mengu <whalb...@gmail.com> wrote:
>
> > > >http://mdp.cti.depaul.edu/examples/default/tools
>
> > > > See the "Custom Authentication" section.
>
> > > > On Jan 10, 12:19 pm, JimK <jkel...@gmail.com> wrote:
>
> > > > > I can't seem to figure out how to display a session.flash message on
> > > > > the following page after a registration.  I think the answer will have
> > > > > something to do with auth.settings.register_onaccept but I'm not sure
> > > > > how to pass the form object to this setting.  Any help would be
> > > > > appreciated.
>
> > > > > Thanks,
>
> > > > > Jim
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@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.


Reply via email to