[Zope3-checkins] CVS: Zope3/src/zope/app/browser - login_failed.pt:1.1 redirect.pt:1.1 auth.py:1.2
Stephan Richter
srichter@cosmos.phy.tufts.edu
Fri, 1 Aug 2003 09:47:47 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser
In directory cvs.zope.org:/tmp/cvs-serv7929/browser
Modified Files:
auth.py
Added Files:
login_failed.pt redirect.pt
Log Message:
If someone pressed cancel during login or after logout, then we got a nice
'None' screen so far. I changed that to display nice screens or redirect
seemlessly.
=== Added File Zope3/src/zope/app/browser/login_failed.pt ===
<html metal:use-macro="context/@@standard_macros/dialog">
<body>
<div metal:fill-slot="body">
<h1>Login Failed!</h1>
<p style="font-size: 150%">
You cancelled the login procedure. Click
<a tal:attributes=
"href python: view.request.get('nextURL', '.')">here</a> to return.
</p>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/redirect.pt ===
<html metal:use-macro="context/@@standard_macros/dialog">
<head>
<metal:block fill-slot="headers">
<meta http-equiv="refresh" content="0;url=./"
tal:attributes="content string:0;;url=${view/request/nextURL}" />
</metal:block>
</head>
<body>
<div metal:fill-slot="body">
<h1>You are being redirected!</h1>
<p style="font-size: 150%">
If you you see this screen, click
<a tal:attributes="href view/request/nextURL">here</a>.
</p>
</div>
</body>
</html>
=== Zope3/src/zope/app/browser/auth.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/auth.py:1.1 Thu Jul 31 23:21:28 2003
+++ Zope3/src/zope/app/browser/auth.py Fri Aug 1 09:47:38 2003
@@ -29,6 +29,7 @@
"""See zope.app.interfaces.security.ILogin"""
if isinstance(self.request.user, UnauthenticatedPrincipal):
self.request.unauthorized("basic realm='Zope'")
+ return self.failed()
else:
if nextURL is None:
return self.confirmation()
@@ -37,6 +38,8 @@
confirmation = ViewPageTemplateFile('login.pt')
+ failed = ViewPageTemplateFile('login_failed.pt')
+
class HTTPAuthenticationLogout(object):
"""Since HTTP Authentication really does not know about logout, we are
@@ -52,10 +55,16 @@
"""See zope.app.interfaces.security.ILogout"""
if not isinstance(self.request.user, UnauthenticatedPrincipal):
self.request.unauthorized("basic realm='Zope'")
+ if nextURL:
+ return self.redirect()
+
+ if nextURL is None:
+ return self.confirmation()
else:
- if nextURL is None:
- return self.confirmation()
- else:
- self.request.response.redirect(nextURL)
+ return self.request.response.redirect(nextURL)
confirmation = ViewPageTemplateFile('logout.pt')
+
+ redirect = ViewPageTemplateFile('redirect.pt')
+
+