A bit late but it was just yesterday that I tried to do it.
Figured out how:
1. Edited web2py/gluon/contrib/login_methods/rpx_account.py
added:
*from gluon.globals import current**
*
2. Added the following to the RPXAccount class just after *last_name =
profile.get("name",dn).get("familyName",""),:*
* photo = profile.get('photo','')*
You'll need to add that to the three (Facebook, Google, and default)
mappings. Then, in the get_user method, after
user = self.mappings.get(provider,self.mappings.default)(self.profile), add
*current.session.photo = user['photo']*
3. Now when you login in your application you'll have *session.photo* which
points to the url of your profile photo.
Em sexta-feira, 10 de junho de 2011 03h14min48s UTC-3, Luis Goncalves
escreveu:
>
> I have Janrain working as a login method (thanks to the instructions in
> the web2py manual, and sample code in default app).
>
> I'd like to include the profile photo (that, say, facebook provides via
> janrain) as part of the user profile.
>
> I had my own function based on the sample code at the Janrain github, but
> so far it doesn't work.
>
> The reason, I believe, is that the token that Janrain provides can only be
> used once.
>
> In my code, either I let user/login use the token, and then my function
> can't retrieve the photo, or I can use the token (with code in user() that
> detects a request.vars.token), but then the web2py login procedure can't
> use the token, and the user can't even login.
>
> I imagine that I could hack away at gluon/tools.py to include retrieving
> the profile photo along with the other user data during the login process,
> but I'm sure that's not the easiest or proper way to do things.
>
> Does anyone have, or can anyone provide an example of the proper way to do
> it?
>
> Thanks!!!
>
> Luis.
>
--