[Repoze-checkins] r944 - in repoze.who/trunk/repoze/who: . plugins
Tres Seaver
tseaver at palladion.com
Sat May 3 19:28:02 EDT 2008
Author: Tres Seaver <tseaver at palladion.com>
Date: Sat May 3 19:28:02 2008
New Revision: 944
Log:
Redirect to current URL, sans login token, after successful login.
Modified:
repoze.who/trunk/repoze/who/plugins/form.py
repoze.who/trunk/repoze/who/tests.py
Modified: repoze.who/trunk/repoze/who/plugins/form.py
==============================================================================
--- repoze.who/trunk/repoze/who/plugins/form.py (original)
+++ repoze.who/trunk/repoze/who/plugins/form.py Sat May 3 19:28:02 2008
@@ -99,6 +99,8 @@
return None
del query[self.login_form_qs]
environ['QUERY_STRING'] = urllib.urlencode(query)
+ environ['repoze.who.application'] = HTTPFound(
+ construct_url(environ))
return {'login':login, 'password':password}
return None
Modified: repoze.who/trunk/repoze/who/tests.py
==============================================================================
--- repoze.who/trunk/repoze/who/tests.py (original)
+++ repoze.who/trunk/repoze/who/tests.py Sat May 3 19:28:02 2008
@@ -1012,10 +1012,14 @@
identifier = DummyIdentifier(credentials)
extra = {'wsgi.input':StringIO(body),
+ 'wsgi.url_scheme': 'http',
+ 'SERVER_NAME': 'localhost',
+ 'SERVER_PORT': '8080',
'CONTENT_TYPE':content_type,
'CONTENT_LENGTH':len(body),
'REQUEST_METHOD':'POST',
'repoze.who.plugins': {'cookie':identifier},
+ 'PATH_INFO': '/protected',
'QUERY_STRING':'',
}
if do_login:
@@ -1056,11 +1060,15 @@
self.assertEqual(result, None)
def test_identify_success(self):
+ from paste.httpexceptions import HTTPFound
plugin = self._makeOne()
environ = self._makeFormEnviron(do_login=True, login='chris',
password='password')
result = plugin.identify(environ)
self.assertEqual(result, {'login':'chris', 'password':'password'})
+ app = environ['repoze.who.application']
+ self.failUnless(isinstance(app, HTTPFound))
+ self.assertEqual(app.location(), 'http://localhost:8080/protected')
def test_remember(self):
plugin = self._makeOne()
More information about the Repoze-checkins
mailing list