quickly sanitized account controller with plain error messages
git-svn-id: http://yolanda.mister-muffin.de/svn@372 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
b6558fb1bf
commit
124c37f6f8
1 changed files with 4 additions and 5 deletions
|
@ -15,11 +15,11 @@ class AccountController(BaseController):
|
||||||
self.consumer = Consumer(self.openid_session, None)
|
self.consumer = Consumer(self.openid_session, None)
|
||||||
openid = request.params.get('username', None)
|
openid = request.params.get('username', None)
|
||||||
if openid is None:
|
if openid is None:
|
||||||
return render('/login/form.mako')
|
return "invalid openid"
|
||||||
try:
|
try:
|
||||||
authrequest = self.consumer.begin(openid)
|
authrequest = self.consumer.begin(openid)
|
||||||
except DiscoveryFailure, e:
|
except DiscoveryFailure, e:
|
||||||
return render('/login/form.mako')
|
return "invalid openid"
|
||||||
|
|
||||||
redirecturl = authrequest.redirectURL(
|
redirecturl = authrequest.redirectURL(
|
||||||
h.url_for('',qualified=True),
|
h.url_for('',qualified=True),
|
||||||
|
@ -41,11 +41,10 @@ class AccountController(BaseController):
|
||||||
session.clear()
|
session.clear()
|
||||||
return redirect_to('/index')
|
return redirect_to('/index')
|
||||||
else:
|
else:
|
||||||
return redirect_to('/login')
|
return "openid auth error"
|
||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
c.title = 'logged out'
|
|
||||||
session.clear()
|
session.clear()
|
||||||
session.save()
|
session.save()
|
||||||
return render('/login/logout.mako')
|
return redirect_to('/index')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue