Tres Seaver
2008-05-04 0b5c18cf5249016264e2d99580c078196b3b0611
Redirect to current URL, sans login token, after successful login.
2 files modified
10 ■■■■■ changed files
repoze/who/plugins/form.py 2 ●●●●● patch | view | raw | blame | history
repoze/who/tests.py 8 ●●●●● patch | view | raw | blame | history
repoze/who/plugins/form.py
@@ -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
repoze/who/tests.py
@@ -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()