##// END OF EJS Templates
authn: Fix form validation of authentication plugins....
johbo -
r102:1a9dcffb default
parent child Browse files
Show More
@@ -474,12 +474,7 b' def loadplugin(plugin_id):'
474 474 """
475 475 Loads and returns an instantiated authentication plugin.
476 476 Returns the RhodeCodeAuthPluginBase subclass on success,
477 raises exceptions on failure.
478
479 raises:
480 KeyError -- if no plugin available with given name
481 TypeError -- if the RhodeCodeAuthPlugin is not a subclass of
482 ours RhodeCodeAuthPluginBase
477 or None on failure.
483 478 """
484 479 # TODO: Disusing pyramids thread locals to retrieve the registry.
485 480 authn_registry = get_current_registry().getUtility(IAuthnPluginRegistry)
@@ -995,9 +995,12 b' def ValidAuthPlugins():'
995 995 from rhodecode.authentication.base import loadplugin
996 996 module_list = value
997 997 unique_names = {}
998 try:
999 998 for module in module_list:
1000 999 plugin = loadplugin(module)
1000 if plugin is None:
1001 raise formencode.Invalid(
1002 _("Can't find plugin with id '{}'".format(module)),
1003 value, state)
1001 1004 plugin_name = plugin.name
1002 1005 if plugin_name in unique_names:
1003 1006 msg = M(self, 'import_duplicate', state,
@@ -1005,8 +1008,6 b' def ValidAuthPlugins():'
1005 1008 next_to_load=plugin_name)
1006 1009 raise formencode.Invalid(msg, value, state)
1007 1010 unique_names[plugin_name] = plugin
1008 except (KeyError, AttributeError, TypeError) as e:
1009 raise formencode.Invalid(str(e), value, state)
1010 1011
1011 1012 return _validator
1012 1013
General Comments 0
You need to be logged in to leave comments. Login now