Hi Caleb,
On Thu, Mar 11, 2010 at 7:07 PM, Caleb James DeLisle <
calebdelisle(a)lavabit.com> wrote:
Guillaume Lerouge asked me on IRC if one could choose
a regex for
validating a password which a user chooses.
This was the question:
CalebJamesDeLisl: do you know whether it's possible to specify a regex for
the password check in the new registration screen?
<glerouge> like, if the password does not have at least 3 numbers, 3
lowecase letters and 3 uppercase letters refuse it
Since he was gone when I woke up, I decided to answer here.
The answer is yes it is quite possible, in fact there is a regex being used
already at the moment the regex only
forces the user to choose a password longer than 5 characters but it can be
changed in the configuration at the top of the
registration page.
The configuration looks like this:
##
##The password field, mandatory and must be at least 6 characters long.
#set($field =
{'name' : 'register_password',
'label' : $msg.get('core.register.password'),
'params' : {
'type' : 'password',
'size' : '10'
},
'validate' : {
'mandatory' : {
'failureMessage' :
$msg.get('xe.admin.registration.fieldMandatory')
},
'regex' : {
'pattern' : '/.{6,}/',
'failureMessage' :
$msg.get('xe.admin.registration.passwordTooShort')
}
}
})
and where it says /.{6,}/ is where you would put the expression (and you
would probably want to change the failure message)
Note that you may not add another regular expression below the one already
existing because the data is stored as a map
and a map can only have one value for the key 'regex'.
Great, thanks :-)
Which makes me think -> did you have the opportunity to add some
documentation about the new registration page on XWiki.org? It might be
useful... and since I know you like writing I thought I'd ask ;-)
Guillaume
Caleb
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Guillaume Lerouge
Product Manager - XWiki SAS
Skype: wikibc
Twitter: glerouge
http://guillaumelerouge.com/