I am with Tom on that one... Better to make something that works 100%
than to double-check the output. 

However, if you want to double-check the output, I would say keep it
simple. Check each rule individually:


must be exactly 8 characters in length
must have at least 1 number
must have at least 1 uppercase letter
must have at least 1 lower case letter


<cfset strPassword = "Ben4Prez" />

<cfif (
        REFind( "^.{8}$", strPassword ) AND
        REFind( "\d+?", strPassword ) AND
        REFind( "[a-z]+?", strPassword ) AND
        REFind( "[A-Z]+?", strPassword )
        )>

        <!--- GOOD. --->
        
<cfelse>

        <!--- BAD. --->
        
</cfif> 


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/


-----Original Message-----
From: Tom Chiverton [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 24, 2007 11:56 AM
To: CF-Talk
Subject: Re: confirming string length, case, and alphanumeric

On Wednesday 24 January 2007 15:28, Richard White wrote:
> though it is supposed to. It probably gets it right 7 out of 10 times.

> I got it from someone on another post and cant see where the problem 
> is. So i thought that when i generate the password i can write some 
> cfscript to check if it meets the criteria and if not then it 
> regenerates it and checks it again

Why not just write a better generator ?
1 Create a random number between 0 and 9
2 Create 1 random upper case letter
3 Create 7 random lower case letters
Concatenate all the results.

There is a built in function to do 1. Once you've done that, you can
generate random numbers with in a range, so you can do 2 (via the ASCII
code for the letters). Once 2 is done, you can use it to do 3 by calling
it 7 times and just ucase() the result.

--
Tom Chiverton
Helping to dynamically pursue leading-edge e-business

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England
and Wales under registered number OC307980 whose registered office
address is at St James's Court Brown Street Manchester M2 2JF.  A list
of members is available for inspection at the registered office. Any
reference to a partner in relation to Halliwells LLP means a member of
Halliwells LLP. Regulated by the Law Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and
may be confidential or legally privileged.  If you are not the addressee
you must not read it and must not use any information contained in nor
copy it nor inform any person other than Halliwells LLP or the addressee
of its existence or contents.  If you have received this email in error
please delete it and notify Halliwells LLP IT Department on 0870 365
8008.

For more information about Halliwells LLP visit www.halliwells.com.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267484
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to