Re: [web2py] Auth.user is still NULL after a successful login

2012-03-12 Thread Bruno Rocha
Why are you passing session=None to .process ?

http://zerp.ly/rochacbruno
Em 12/03/2012 09:43, Sushant Taneja sushant.tanej...@gmail.com escreveu:

 Hi,

 Following is the snippet from my db.py global file:

 db = DAL('google:datastore')

 from gluon.tools import Auth
 auth = Auth(db, hmac_key=Auth.get_or_create_key())

 auth.settings.login_url = URL('default','index')
 auth.settings.logged_url = URL('user','profile')
 auth.settings.login_next = URL('user','profile')

 auth.define_tables()


 In my controller default/index controller I have used the following:

 def index():

 login_form = auth.login()
 if login_form.process(session=None,formname='login').accepted:
 pass
 elif login_form.errors:
 response.write(request.vars)
 return dict()

 to display the form I have used the SQLForm in HTML technique as mentioned
 in the web2py book

 Whenever user enters the correct email and password. auth_event registers
 a login event with the description *User 1 Logged In*.
 The next property redirects the URL to /user/profile but auth.user object
 is *None.*
 *
 *
 Is there some auth setting that I am missing or something else is the
 reason of this ?

 Thanks,
 Sushant





Re: [web2py] Auth.user is still NULL after a successful login

2012-03-12 Thread Sushant Taneja
Hi,

I passed the session=None since I was following example in the book.
I removed it from the process method and now I am using 

   login_form = auth.login()
if login_form.process(formname='login').accepted:
pass
elif login_form.errors:
response.write(request.vars)
return dict()

but now when I try to login, nothing happens. No event is recorded in 
auth_event and there is also no redirection.

On Monday, March 12, 2012 7:20:01 PM UTC+5:30, rochacbruno wrote:

 Why are you passing session=None to .process ?

 http://zerp.ly/rochacbruno
 Em 12/03/2012 09:43, Sushant Taneja sushant.tanej...@gmail.com 
 escreveu:

 Hi,

 Following is the snippet from my db.py global file:

 db = DAL('google:datastore')

 from gluon.tools import Auth
 auth = Auth(db, hmac_key=Auth.get_or_create_key())

 auth.settings.login_url = URL('default','index')
 auth.settings.logged_url = URL('user','profile')
 auth.settings.login_next = URL('user','profile')

 auth.define_tables()


 In my controller default/index controller I have used the following:

 def index():

 login_form = auth.login()
 if login_form.process(session=None,formname='login').accepted:
 pass
 elif login_form.errors:
 response.write(request.vars)
 return dict()

 to display the form I have used the SQLForm in HTML technique as 
 mentioned in the web2py book

 Whenever user enters the correct email and password. auth_event registers 
 a login event with the description *User 1 Logged In*.
 The next property redirects the URL to /user/profile but auth.user object 
 is *None.*
 *
 *
 Is there some auth setting that I am missing or something else is the 
 reason of this ?

 Thanks,
 Sushant