On 01/18/2010 09:25 AM, Caleb James DeLisle wrote:
Hello all,
I am working on refactoring the registration page. I have a mockup which uses the view
action so that the register action is not needed, I'm not sure if it makes more sense
to
remain a template or be moved to an application, any thoughts on this?
There are a few apis which would make this job a lot easier and cleaner.
I would like to provide Velocity access to ConfigurationSource. There would be a
configuration parameter which a list of configuration parameters that Velocity
is allowed to read. I think it makes the most sense to add a VelocityContextInitializer
to the default Configuration implementation which injects a ConfigurationSource wrapper.
Perhaps name it $configurationsource
Currently (in my mockup) there is no way to tell the guest who is registering that their
chosen user name is taken or is invalid if the captcha is wrong, this is because the
username
is checked by $xwiki.createUser after the captcha is verified. If we add the following
two
apis then all of the checking can be done on the Velocity side.
$xwiki.isUsernameAvailable(String name)
This will check if the name is the name of the superuser then check if a document
exists by that name. Should I be using an EntityReference? I lean toward string because
that is what the user types in.
This can be done as a velocity macro using $xwiki.exists and
$xwiki.getDocument(...).getObject('XWiki.XWikiUsers') for the moment.
$util.compilePattern(String regex)
Returns a Pattern or null if regex is invalid because Perl5Util methods all throw
exceptions which Velocity can't catch.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/