I built a new openid module today which I'm hoping to include with
web.py. It has a rather different API from weboid, so I thought I'd
send it to the list to find out what you think. Here's a simple web.py
app with one page where all you do is log in or find out that you're
logged in and log out:
import web
urls = (
'/', 'index',
'/openid', 'web.openid.host',
)
class index:
def GET(self):
oid = web.openid.status()
if not oid:
print '<p>please log in:</p>' + web.openid.form('/openid')
else:
print '<p>you are logged in as:</p>' + web.openid.form('/openid')
print '<p><strong>%s</strong> is your OpenID username</p>' % oid
What do you think?
The form function, which you can easily reimplement is just:
def form(openid_loc):
oid = status()
if oid:
return '''
<form method="post" action="%s">
<img src="http://openid.net/login-bg.gif" alt="OpenID" />
<strong>%s</strong>
<input type="hidden" name="action" value="logout" />
<input type="hidden" name="return_to" value="%s" />
<button type="submit">log out</button>
</form>''' % (openid_loc, oid, web.ctx.fullpath)
else:
return '''
<form method="post" action="%s">
<input type="text" name="openid" value=""
style="background: url(http://openid.net/login-bg.gif)
no-repeat; padding-left: 18px; background-position: 0 50%%;" />
<input type="hidden" name="return_to" value="%s" />
<button type="submit">log in</button>
</form>''' % (openid_loc, web.ctx.fullpath)
My hope is that this will make most user-wrangling -- taking care of
log ins, log outs, securely-stored passwords, forgotten passwords,
etc. -- basically unnecessary. Thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---