Something like this?

def page1():
    form=SQLFORM.factory(Field('email',requires=IS_IN_DB
(db,'auth_user.email')))
    if form.accepts(request.vars, session):
          redirect(URL(r=request,f='page2',dict(em=form.vars.email))
    return dict(form=form)

{{extend 'layout.html'}}{{=form}}

def page2():
    rows=db(db.auth_user.email==request.vars.em).select()
    if not rows: redirect(URL(r=request,f='page1'))
    return dict(name=rows.first().first_name)

{{extend 'layout.html'}}Hello {{=name}}


Mind that you do not need anything like this if your purpose is login.
In that case web2py already provides method for login and the user
info is simply in
{{=auth.user.first_name}} {{=auth.user.last_name}}


On Oct 9, 1:34 am, ed <edbi...@rocketmail.com> wrote:
> Hi Massimo,
> Okay, redirect returns page but without any variable. Any hint how to
> render a page name "loggedin" that says; "Hi Ed, welcome!" after a
> succesful login using the code i created?. Sorry, i'm a newbie with
> very limited web2py knowledge and stucked on this.  Thank you in
> advance Massimo.
>
> On Oct 9, 11:58 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > mind that redirect is a function that raises an HTTP exception which
> > causes the server to send and HTTP 303 response. redirect never
> > returns and your view is never rendered.
>
> > Massimo
>
> > On Oct 8, 9:22 pm, ed <edbi...@rocketmail.com> wrote:
>
> > > The display went well because i filled a session with a constant "Ed"
> > > and not a result of a db().select(). So, the constant variable was
> > > displayed without a hitch. When i used db().select() the display went
> > > like:
> > > [{'first_name': 'Ed'}]
> > > The above display is the result of the following code:
> > > Controller:
> > > if form.accepts(request.vars, session):
> > >     em=request.vars.emailad
> > >     name1 = db(db.auth_user.email==em).select(db.auth_user.first_name)
> > > [0]
> > >     name=name1.first_name
> > >     return dict(red=redirect(URL(r=request,f='loggedin')), name=name)
> > > ..................
> > > View:
> > > {{extend 'layout2.html'}}
> > > <p>
> > > <p><h3>Hi {{=name}}</h3></p>
> > > <p>
> > > .................
> > >  This was the result of the view, "Hi [{'first_name': 'Ed'}]". I've
> > > googled and searched the manual and tried examples but to no avail.
> > > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to