diff --git a/kallithea/lib/auth.py b/kallithea/lib/auth.py --- a/kallithea/lib/auth.py +++ b/kallithea/lib/auth.py @@ -35,7 +35,6 @@ from decorator import decorator from tg import request, session from tg.i18n import ugettext as _ -from webhelpers.pylonslib import secure_form from sqlalchemy.orm.exc import ObjectDeletedError from sqlalchemy.orm import joinedload from webob.exc import HTTPFound, HTTPBadRequest, HTTPForbidden, HTTPMethodNotAllowed diff --git a/kallithea/model/validators.py b/kallithea/model/validators.py --- a/kallithea/model/validators.py +++ b/kallithea/model/validators.py @@ -22,7 +22,6 @@ import logging from collections import defaultdict from tg.i18n import ugettext as _ from sqlalchemy import func -from webhelpers.pylonslib.secure_form import authentication_token import sqlalchemy from formencode.validators import ( @@ -306,19 +305,6 @@ def ValidAuth(): return _validator -def ValidAuthToken(): - class _validator(formencode.validators.FancyValidator): - messages = { - 'invalid_token': _('Token mismatch') - } - - def _validate_python(self, value, state): - if value != authentication_token(): - msg = self.message('invalid_token', state) - raise formencode.Invalid(msg, value, state) - return _validator - - def ValidRepoName(edit=False, old_data=None): old_data = old_data or {} diff --git a/kallithea/tests/other/test_validators.py b/kallithea/tests/other/test_validators.py --- a/kallithea/tests/other/test_validators.py +++ b/kallithea/tests/other/test_validators.py @@ -139,13 +139,6 @@ class TestRepoGroups(TestController): with pytest.raises(formencode.Invalid): validator.to_python(invalid_creds) - def test_ValidAuthToken(self): - validator = v.ValidAuthToken() - # this is untestable without a threadlocal -# self.assertRaises(formencode.Invalid, -# validator.to_python, 'BadToken') - validator - def test_ValidRepoName(self): validator = v.ValidRepoName()