diff --git a/mopidy/frontends/mpd/dispatcher.py b/mopidy/frontends/mpd/dispatcher.py index 405ca03d..4ae1e184 100644 --- a/mopidy/frontends/mpd/dispatcher.py +++ b/mopidy/frontends/mpd/dispatcher.py @@ -70,7 +70,10 @@ class MpdDispatcher(object): ### Filter: authenticate def _authenticate_filter(self, request, response, filter_chain): - if self.authenticated or settings.MPD_SERVER_PASSWORD is None: + if self.authenticated: + return self._call_next_filter(request, response, filter_chain) + elif settings.MPD_SERVER_PASSWORD is None: + self.authenticated = True return self._call_next_filter(request, response, filter_chain) else: command = request.split(' ')[0] diff --git a/tests/frontends/mpd/authentication_test.py b/tests/frontends/mpd/authentication_test.py index 03fc5718..d795d726 100644 --- a/tests/frontends/mpd/authentication_test.py +++ b/tests/frontends/mpd/authentication_test.py @@ -28,7 +28,7 @@ class AuthenticationTest(unittest.TestCase): def test_authentication_with_anything_when_password_check_turned_off(self): settings.MPD_SERVER_PASSWORD = None response = self.dispatcher.handle_request(u'any request at all') - self.assertFalse(self.dispatcher.authenticated) + self.assertTrue(self.dispatcher.authenticated) self.assert_('ACK [5@0] {} unknown command "any"' in response) def test_anything_when_not_authenticated_should_fail(self):