Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Force to use strong password
Message
De
06/11/2006 20:05:45
 
 
À
06/11/2006 13:51:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01167371
Message ID:
01167548
Vues:
10
Just a thought. You could put the onus on the user by explaining a strong password in at tooltip balloon. Then if they choose to not use a strong password, you have done your job and they didn't take your advice. If someone breaks in then it's the user's fault.

Grady


>>>If you mean in a VFP app, it should be pretty easy. Spin through the string, looking at each character. Keep a running count of how many are ISDIGIT(), ISUPPER() and ISLOWER(). You have a strong password if:
>>>
>>>( LEN() >= 6 ) AND( DigitCount >= 1 ) AND ( NonDigitCount >= 2 ) AND ( UpperCount >= 1 ) AND ( LowerCount >= 1 )
>>
>>I doänt understand the need for NonDigitCount. Is the following code best way to check for a strong password ?
>>
>>
FUNCTION IsStrongPassword( cStr )
>>
>>LOCAL i, nDigitCount, nUpperCount, nLowerCount
>>STORE 0 TO nDigitCount, nUpperCount, nLowerCount
>>FOR i=1 TO LEN(cStr)
>>  DO case
>>    CASE ISDIGIT( SUBSTR(m.cStr,m.i))
>>      nDigitCount = nDigitCount + 1
>>
>>    CASE ISUPPER(SUBSTR(m.cStr,m.i))
>>      nUpperCount = nUpperCount + 1
>>
>>    CASE ISLOWER(SUBSTR(m.cStr,m.i))
>>      nLowerCount = nLowerCount + 1
>>    ENDCASE
>>ENDFOR
>>
>>RETURN LEN(m.cStr)>5 AND m.nUpperCount>0 AND m.nLowerCount>0
>
>How about something like this - might be faster than loops.
>
>
>LPARAMETERS tcPwd
>LOCAL lcDigit, lcAlpha, llStrong
>
>llStrong = .F.
>lcDigit = "0123456789"
>lcAlpha = "abcdefghijklmnopqrstuvwxyz"
>
>IF LEN(tcPWd) > 5 AND ;
>   LEN(tcPwd) <> LEN(CHRTRAN(tcPwd, lcDigit, "")) AND ;
>   LEN(tcPwd) <> LEN(CHRTRAN(tcPwd, UPPER(lcAlpha), "")) AND ;
>   LEN(tcPwd) <> LEN(CHRTRAN(tcPwd, LOWER(lcAlpha), ""))
>	
>   llStrong = .T.
>ENDIF
>
>RETURN llStrong
>
I ain't skeert of nuttin eh?
Yikes! What was that?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform