Hi folks,

I'm new to Trac development, but with some guidance and input from  
Jeff Hammel, I've written a patch for AccountManager. The patch  
provides an extension point for adding fields to the new user  
registration page and then verifying them after the form has been  
submitted. It's exposed by the IRegistrationConfirmation interface,  
which includes two methods: pre_registration(), which returns the  
markup of the elements to be added to the registration page, and  
verify_registration(), which returns an error message to display if  
registration should fail or None upon success.

http://trac-hacks.org/wiki/RegistrationConfirmationPatch

One use-case for such functionality is adding a CAPTCHA. However,  
since the interface is quite general, it could be used for others  
things, e.g., e-mail verification of new users.

As an example use of this interface, I've written SimpleCaptcha, which  
uses Skimpy Gimpy to add a CAPTCHA to the new user registration form:

http://trac-hacks.org/wiki/SimpleCaptchaPlugin

For comparison, a proof-of-concept stand-alone plugin for CAPTCHAs is  
available here:

https://svn.openplans.org/svn/TracPlugins/CaptchaAuth/

Using an approach like that used by CaptchaAuth has the advantage that  
it works without requiring any alterations to AccountManager. However,  
if generalized registration confirmation is a desirable extension to  
AccountManager, the patch + SimpleCaptcha implementation makes  
CaptchaAuth look hackish.  CaptchAuth has to use an XPath expression  
to find the part of the form to grab onto, which means it's  
susceptible to changes in the form. Also, error messages are poorly  
integrated (right now it just raises a TracError). Using the  
RegistrationConfirmationPatch for AccountManager gets around both of  
these issues and also makes it easier for other registration-related  
plugins to be written without touching AccountManager.

The interface proposed here is by no means set in stone, but is a  
rough-draft implementation that should be altered or extended  
according to what developers would want to do with user registration.  
As it stands, it's a very generalized interface for pre- and post-form  
submission and could either be specialized as the problem becomes  
further defined or extended if more functionality is needed.  For  
instance, all additions using the RegistrationConfirmation patch are  
placed in the "required" portion of the registration form.   
AccountManger now has email registration, but though email is a  
required field for this, it is still shown in the "optional" section,  
so keeping track of optional versus required fields might be desirable  
too.  This and other extensions to the interface are possible,  
depending on what people want to do. I welcome any input.

What do folks think re: writing a stand-alone plugin vs. adding an  
extension point to AccountManager and then hooking in to that? I'll  
admit that the latter seems a better way to me, but as I said, I'm  
very new to Trac development and I'm just getting my feet wet here.  
I'd love to hear from some of the veteran developers and other members  
of the community to find out what path they think is the best to pursue.

Best,
        -Nicholas Bergson-Shilcock

The Open Planning Project
http://topp.openplans.org



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to