Hello, Ian. It sounds like you've not added the plugin to the authenticators in repoze.who.
Make sure to add "form" to both the identifiers and challengers. HTH, - Gustavo. On 15/04/10 17:22, Ian Stevens wrote: > I've built a LDAP authorizing login using repoze.who-1.0.10 and > repoze.who.plugins.ldap-1.0 under Pylons-0.9.7. Now I want to use > repoze.who_friendlyform-1.0.4 to report an incorrect login message to the > user. Unfortunately, the login count doesn't seem to be incrementing. > > Before I go into detail, is there a simpler way to display a message to the > user on a failed login? Am I dense or is this much more than an effort than > it should be? Most searches I've tried pull up FriendlyForm. > > The problem is that > repoze.who.plugins.friendlyform.FriendlyFormPlugin.challenge() does not get > called on a login attempt, so the counter (in both environ and the query) > doesn't increment. Valid users authenticate OK. > > I wrote my own authenticator which checks to see whether an authorized LDAP > user exists in the app DB, and my own mdprovider which copies the related > user object from the DB to the repoze identity. Everything else is in line > with the tutorials. > > The code and config is below. The make_redirecting_plugin method which > FriendlyForm lacks is ripped from repoze.who.plugins.form. Any ideas as to > how to get this working would much appreciated. > > thanks, > Ian. > > The form section of who.ini: > > [plugin:form] > use = foo.lib.auth:make_redirecting_plugin > login_form_url = /login > login_handler_path = /dologin > logout_handler_path = /logout > rememberer_name = auth_tkt > > [plugin:auth_tkt] > use = repoze.who.plugins.auth_tkt:make_plugin > secret = sekrit > > Method referenced above: > > def make_redirecting_plugin(login_form_url=None, > login_handler_path='/login_handler', > logout_handler_path='/logout_handler', > rememberer_name=None): > """Taken from repoze.who.plugins.form for FriendlyForm.""" > if login_form_url is None: > raise ValueError( > 'must include login_form_url in configuration') > if login_handler_path is None: > raise ValueError( > 'login_handler_path must not be None') > if logout_handler_path is None: > raise ValueError( > 'logout_handler_path must not be None') > if rememberer_name is None: > raise ValueError( > 'must include rememberer key (name of another IIdentifier > plugin)') > plugin = FriendlyFormPlugin(login_form_url, > login_handler_path, > None, > logout_handler_path, > None, > rememberer_name) > return plugin > > The code for generating the login form: > > def login(self): > identity = request.environ.get('repoze.who.identity') > if identity is not None: > came_from = request.params.get('came_from', None) > if came_from: > redirect_to(str(came_from)) > > return render('/login.mako').encode('utf8') > > The above template checks the counter in environ and outputs a login error if > it's greater than 0. > _______________________________________________ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > -- Gustavo Narea <xri://=Gustavo>. _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev