Hi All, 
My fault. Web2py handbook says: 
"Don't store user-defined classes in session"
I will have to re-read the basics after not touching framework for a long 
time (since the luck of troubles).
Thanks for your time.
Marcin




W dniu środa, 30 lipca 2014 14:39:38 UTC+2 użytkownik Marcin Jaworski 
napisał:
>
> Hi Massimo,
> Thanks for your input. 
> Yes, they would receive email, since they have got external (out of google 
> services) email accounts.
> I realized that I should describe shortly my approach.
>
> Most of aplication users will use GaeGoogleLogin. 
> There are only few that will use alternative login method.
> The minority have their own records in datastore with id, login and 
> password. 
>
> How to authenticate the minority?
> I have found function in web2py.gluon.tools.Auth called login_user() that 
> should log in requested user as can be checked via is_logged_id(). 
> I prepared separate login screen (avoiding Google login) getting user 
> input namely login and password.
> Now If user input match user data I would like use auth.user_login() to 
> get 'logged in' status.
> Suppose that I have empty class ChineseUser in db.py and I am 
> instantiating it in default controller like so:
>
> user = ChineseUser()
>
> and I am binding required (by other gluon functions) attributes like so:
> user.id = id_taken_from_database
> user.email = email_taken_from_database
>
> and I am using auth.user_login(user) to log in the user. 
> call of 'if auth.is_logged_in()' confirms the success of logging operation
> And within one function all is fine, which means session.auth.user.id 
> returns correct id of the user that have been logged in.  
>
> Unfortunately, calling session variables (session.auth.user.id) or 
> auth.user.id within other function(s) returns error saying None type(s) 
> (session and auth in this case) have no requested attributes (id).
>
> How to provide session and auth (meaning the session and the auth called 
> by 'my' loggin in method - not the Google LoginService based method) to 
> hold their states across functions?
>
> Thanks in advance,
> Marcin
>
> On Tuesday, July 29, 2014 5:42:30 PM UTC+2, Massimo Di Pierro wrote:
>>
>> Even if you use GaeGoogleLogin the auth_user table contains both id and 
>> email (as provided by gmail). Now if you switch from GaeGoogleLogin to 
>> local authentication and email everybody a link to reset the password they 
>> will not need to register again and therefore they will retain the current 
>> id. I have not tried this but should work.
>>
>> For example you can make a script that does:
>>
>> auth.messages.reset_password = 'You must reset your password. Click on 
>> the link %(link)s to reset your password'
>> for user in db(db.auth_user).select(): auth.email_reset_password(user)
>>
>> Now the issue is, if they cannot access GAE for login, would they receive 
>> the email?
>>
>>
>> On Tuesday, 29 July 2014 09:01:07 UTC-5, Marcin Jaworski wrote:
>>>
>>> Hello,
>>>
>>> I have web2py on GAE and it works fine. Unfortunately, clients from 
>>> China cannot access Google ServiceLogin lately. I have declared it in db.py 
>>> settings like so: auth.settings.login_form=GaeGoogleAccount() after 
>>> importing this method from gluon.contrib.login_methods.gae_google_account. 
>>> I need some kind of "fix" or rather some kind of enhanced, alternative 
>>> solution enabling users from China to be authenticated via available web2py 
>>> Auth class despite the fact Google ServiceLogin is not accessible for them 
>>> and most of the remaining users should be logged in via Google 
>>> ServiceLogin? The problem (?) is that huge parts of application 
>>> functionality id based on calling auth.user.id in controllers and views 
>>> after auth tables based on declared login method had been generated. Is 
>>> there any painless solution not to give up the auth.user.id construct 
>>> in function call, but redefining the reference of auth in my situation? 
>>>
>>> Thanks in advance,
>>> Marcin
>>>
>>>
>>> BI-Lion Analytics
>>> mobile: +48 728805555
>>>
>>
> BI-Lion Analytics
> mobile: +48 728805555
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to