The login form object is passed to the login_onaccept callback, so you can 
access form.vars, for example.

Anthony

On Tuesday, September 8, 2015 at 4:20:57 PM UTC-4, Robert Porter wrote:
>
> Hopefully I got this right.  The book falls apart a bit in the later 
> chapters.  (I just noticed that it references 
> "auth.settings.allows_basic_login = False" in that chapter, but it should 
> be "allow", not "allows".)
>
> Here's what I did:
>
> # [BUG] No idea if this actually works.
> def stay_logged(x):
>  if auth.user:
>  session.auth.expiration = response.session_cookie_expires = auth.settings
> .long_expiration
>  session.auth.remember_me = True
>
>
> auth.settings.remember_me_form = False
> auth.settings.long_expiration=36000000 # seconds
>
>
> auth.settings.login_onaccept = stay_logged
>
>
>
>
> I'd be more confident if it didn't kick errors at me saying stay_logged() 
> has to take a variable, since I'm not sure what variable it's being fed.
>
> Thanks for your help on this.
>
> On Tuesday, 8 September 2015 12:30:09 UTC-7, Anthony wrote:
>>
>> No, please look up login_onaccept in the book -- the last three lines 
>> belong there.
>>
>> Anthony
>>
>> On Tuesday, September 8, 2015 at 2:38:25 PM UTC-4, Robert Porter wrote:
>>>
>>> Ok, so now all I've got that's login-related in my db.py is:
>>>
>>> auth.settings.long_expiration=36000000 # seconds
>>> if auth.user:
>>> session.auth.expiration = response.session_cookie_expires = 
>>> auth.settings.long_expiration
>>> session.auth.remember_me = True
>>>
>>> Is that what you meant?  It's not throwing an error now, but I also have 
>>> no idea if this will actually extend the expiration.
>>>
>>> On Saturday, 5 September 2015 21:55:26 UTC-7, Robert Porter wrote:
>>>>
>>>> How can I make a login persistent.  I want you to have to clean your 
>>>> cookies to ever be logged out.
>>>>
>>>> Right now I have a bug where I get logged out after a pretty short time 
>>>> (even though I set auth.settings.expiration=36000000), so I just want a 
>>>> way 
>>>> where you absolutely cannot logout unless you clean your cookies or hit my 
>>>> logout button.  I want to disable the possibility, not just "extend" the 
>>>> expiration.
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to