##// END OF EJS Templates
fixed hardcoded admin prefix check in forms
marcink -
r1533:c0e60575 beta
parent child Browse files
Show More
@@ -32,6 +32,7 b' from formencode.validators import Unicod'
32 from pylons.i18n.translation import _
32 from pylons.i18n.translation import _
33 from webhelpers.pylonslib.secure_form import authentication_token
33 from webhelpers.pylonslib.secure_form import authentication_token
34
34
35 from rhodecode.config.routing import ADMIN_PREFIX
35 from rhodecode.lib.utils import repo_name_slug
36 from rhodecode.lib.utils import repo_name_slug
36 from rhodecode.lib.auth import authenticate, get_crypt_password
37 from rhodecode.lib.auth import authenticate, get_crypt_password
37 from rhodecode.lib.exceptions import LdapImportError
38 from rhodecode.lib.exceptions import LdapImportError
@@ -240,7 +241,7 b' def ValidRepoName(edit, old_data):'
240 repo_name = value.get('repo_name')
241 repo_name = value.get('repo_name')
241
242
242 slug = repo_name_slug(repo_name)
243 slug = repo_name_slug(repo_name)
243 if slug in ['_admin', '']:
244 if slug in [ADMIN_PREFIX, '']:
244 e_dict = {'repo_name': _('This repository name is disallowed')}
245 e_dict = {'repo_name': _('This repository name is disallowed')}
245 raise formencode.Invalid('', value, state, error_dict=e_dict)
246 raise formencode.Invalid('', value, state, error_dict=e_dict)
246
247
@@ -286,7 +287,7 b' def ValidForkName():'
286 repo_name = value.get('fork_name')
287 repo_name = value.get('fork_name')
287
288
288 slug = repo_name_slug(repo_name)
289 slug = repo_name_slug(repo_name)
289 if slug in ['_admin', '']:
290 if slug in [ADMIN_PREFIX, '']:
290 e_dict = {'repo_name': _('This repository name is disallowed')}
291 e_dict = {'repo_name': _('This repository name is disallowed')}
291 raise formencode.Invalid('', value, state, error_dict=e_dict)
292 raise formencode.Invalid('', value, state, error_dict=e_dict)
292
293
General Comments 0
You need to be logged in to leave comments. Login now