It is worth noting that you will need to get the python-openid package
from (
http://pypi.python.org/pypi/python-openid/) and add the 'openid'
folder to the folder 'web2py/site-packages' in your project so it can
be referenced by 'openid_auth.py'
On Mar 30, 1:03 pm, Will Stevens <
williamstev...@gmail.com> wrote:
> Ya, I had setup Janrain previously and it worked, but my application
> needs control (or at least awareness) of which login types are being
> used and are associated with a user.
>
> The good new is that I JUST FIGURED IT OUT!!! :)
>
> My setup:
> I have both the regular auth setup as well asopenid, so on the login
> page, you will have both forms. On the profile page, you can
> associate anopenidwith your account, after which you will be able to
> login using thatopenid.
>
> *** NOTE: ***
> I had to fix two bugs in 'gluon/contrib/login_methods/openid_auth.py'
> to get this working...
>
> gluon/contrib/login_methods/openid_auth.py on line 243
> - print "[DB] %s authenticated" % oid
> + #print "[DB] %s authenticated" % oid
> (this print statement was ok with the built in server, but on GAE
> caused the redirect to not work because the print was output before
> the headers were sent.)
>
> gluon/contrib/login_methods/openid_auth.py on line 244
> - self.db.alt_logins.insert(username=oid, user=user)
> + self.db.alt_logins.insert(username=oid, user=
user.id) #changed user
> to
user.id to fix insert error
>
> In my application:
>
> == db.py ==
> from gluon.contrib.login_methods.openid_auth import OpenIDAuth
> openid_login_form = OpenIDAuth(auth)
>
> == controller ==
> def user():
> if 'janrain_nonce' in request.vars: # ifopenidform has been
> submitted
> auth.settings.login_form = openid_login_form
> return dict(form=auth())
>
> if 'login' in request.args: # if we are on the login page
> form = DIV(
> DIV(auth()),
> DIV(openid_login_form.login_form()))
> else:
> form = auth()
>
> if 'profile' in request.args: # if we are on the profile page
> form = DIV(form, openid_login_form.list_user_openids()) # append
> theopenid'sfor this user to the login form (also appends the 'addopenid' form)
>
> return dict(form=form)
>
> Thats it... I hope this will save others the hassle I have gone
> through getting this working.
>
> Cheers,
>
> Will
>
> On Mar 30, 12:45 pm, Arbie Samong <
phek...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hey man you may want to use janrain which also supportsopenid. I use
> > > > > > > if 'janrain_nonce' in request.vars: # ifopenidform has been
> > > > > > > submitted
> > > > > > > auth.settings.login_form = openid_login_form
> > > > > > > return dict(form=auth())
>
> > > > > > > if 'login' in request.args: # if we are on the login page
> > > > > > > form = DIV(
> > > > > > > DIV(auth()),
> > > > > > > DIV(openid_login_form.login_form()))
> > > > > > > else:
> > > > > > > form = auth()
>
> > > > > > > if 'profile' in request.args: # if we are on the profile page
> > > > > > > form = DIV(form, openid_login_form.list_user_openids()) # append
> > > > > > > theopenid'sfor this user to the login form (also appends the 'add
> > > > > > >openid' form)
>
> > > > > > > return dict(form=form)
>
> > > > > > > This appends theOpenIDlogin form to the 'login' page. It also
> > > > > > > appends the 'list openids' to the profile page. If theopenidform is
> > > > > > > submitted it will be caught by the first if statement in the
> > > > > > > controller and get handled by auth.
>
> > > > > > > NOTE:
> > > > > > > On line 244 of gluon/contrib/login_methods/openid_auth.py there is bug
> > > > > > > that I had to fix in order for this to work.
> > > > > > > - self.db.alt_logins.insert(username=oid, user=user)
> > > > > > > + self.db.alt_logins.insert(username=oid, user=
user.id) #changed user
> > > > > > > to
user.id to get rid of db error...
>
> > > > > > > With this configuration I have been able to successfully (on default
> > > > > > > server):
> > > > > > > - login using the basic auth form.
> > > > > > > - view my profile and see theopenidlist (with form).
> > > > > > > - in the profile, add an open id to the list.
> > > > > > > - in the profile, remove an open id from the list.
> > > > > > > - login using the associatedopenidfor a specific user.
> > > > > > > (everything works as expected)
>
> > > > > > > On GAE I have the following:
> > > > > > > - login using the basic auth form. (works)
> > > > > > > - view my profile and see theopenidlist (with form). (works)
> > > > > > > - in the profile, add an open id to the list. (see note below)
> > > > > > > - in the profile, remove an open id from the list. (works)
> > > > > > > - login using the associatedopenidfor a specific user. (works)
>
> > > > > > > The main problem I have now is that when I associate anOpenIDwith an
> > > > > > > account (aka - on the profile page, enter anopenidinto the form and