(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])\\w+$
If the characters in this pattern break the inline validator parsing (not sure if they will or not), you'll have to define a pattern validator bean like this:
<bean name="passwordValidator" class="org.apache.tapestry.valid.PatternValidator" lifecycle="page"> <set name="patternString">'(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])\\w+$'</set>
<set name="patternNotMatchedMessage">
"Password must contain at least one lowercase character, one
uppercase character and one digit."
</set>
</bean>
and use it like this:
<component id="password" type="TextField">
<binding name="value" value="password"/>
<binding name="hidden" value="true"/>
<binding name="validators"
value="validators:required,minLength=8,$passwordValidator"/>
<binding name="displayName" value="literal:le mot de passe"/>
</component>
-Ryan
ZedroS Schwart wrote:
Hi all
In order to check the password entered, I currently do in my doClick()
method the following check :
passwordOk = (Pattern.matches("\\w+", password)
&& Pattern.matches(".*[a-z].*", password)
&& Pattern.matches(".*[A-Z].*", password) && Pattern.matches
(
".*[0-9].*", password));
Would it be possible to do it directly in the application page, something
like this for example :
<component id="password" type="TextField">
<binding name="value" value="password"/>
<binding name="hidden" value="true"/>
<binding name="validators"
value="validators:required,minLength=8,pattern=*insert good pattern here*"/>
<binding name="displayName" value="literal:le mot de passe"/>
</component>
I'm not at ease with this pattern stuff so I'm eager to take any idea
working !
Thanks in advance
ZedroS
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
