Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interactive change -- syntax for passwords
Message
From
12/05/2020 00:37:31
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
11/05/2020 20:12:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01674351
Message ID:
01674355
Views:
64
Hi,
Checking for occurrence special chars in a string without loop:
#define dcCharsSearched   "!@#$%^&*_-+=':;.,"

if EMPTY(LEN(CHRTRAN(m.lcChar,CHRTRAN(m.lcChar,dcCharsSearched,''),''))) THEN
*none of dcCharsSearched in m.lcChar
...
I think you should not mix CASE and IF.

do a long CASE or a stacked IF

example where it fails:
*if this line is true:
     CASE m.lcChar >= 8
*the following line must be true (same expression):
      	 IF m.lcChar >= 8
      	 	ThisForm.Pw1_Shape_8.BackColor = RGB(0,255,0)
      	 ELSE
*than this line is a kind of a comment:
      	 	ThisForm.Pw1_Shape_8.BackColor = RGB(163,5,29)
     	 endif     
I would check all limitations first into vars and then colour the box accordingly, like:
llSpecial = !EMPTY(LEN(CHRTRAN(m.lcChar,CHRTRAN(m.lcChar,dcCharsSearched,''),'')))
llLen = LEN(m.lcChar)>8
do case
 case !(llSpecial or llLen)
  ThisForm.Pw1_Shape_8.BackColor = RGB(...
 case !llSpecial
  ThisForm.Pw1_Shape_8.BackColor = RGB(...
 case !llLen
  ThisForm.Pw1_Shape_8.BackColor = RGB(...
 otherwise
  ThisForm.Pw1_Shape_8.BackColor = RGB(...
endcase
pro tip: check the use of pre tag.

>Howdy all,
>
>Attempting to evaluate a user password as they are setting up their accounts for the first time to ensure it meets the following criteria:
>
>at least 2 uppder case letters
>at least 2 special characters
>at least 2 numbers
>must be atleast 8 characters but no more than 15.
>
>I have my user entry form setup with red round shapes that i cam changing the colors to green as the user is entering in their desired password. As it meets the syntax criteria in the text box i would like for those colors to change from red to green. The code is being placed in the interactive change section . But unfortnately it is not happening. The code is below. Hopefully someone smarter than I can assist figuring it out. I considered putting the code in a For Endfor loop within the Interactive change event of the text box.
>
>m.lcChar = Substr(this.value,1)
>
> Do Case
> Case m.lcChar $ "!@#$%^&*_-+=':;.,"
> oVar.punctuation = oVar.punctuation + 1
>
> IF oVar.punctuation => 2
> ThisForm.Pw1_Shape_2spec.BackColor = RGB(0,255,0)
> ELSE
> ThisForm.Pw1_Shape_2spec.BackColor = RGB(163,5,29)
> ENDIF
>
> Case Isalpha(m.lcChar)
> If Isupper(m.lcChar)
> oVAr.upCase = oVAr.upCase + 1
>
> IF oVar.UpCase >= 2
> ThisForm.Pw1_Shape_2cap.BackColor = RGB(0,255,0)
> ELSE
> ThisForm.Pw1_Shape_2cap.BackColor = RGB(163,5,29)
> endif
> Else
> oVar.LowCase = oVar.LowCase + 1
> Endif
>
> Case Isdigit(m.lcChar)
> oVar.digit = oVar.digit + 1
>
> IF Ovar.Digit >= 2
> ThisForm.Pw1_Shape_2numb.BackColor = RGB(0,255,0)
> ELSE
> ThisForm.Pw1_Shape_2numb.BackColor = RGB(163,5,29)
> ENDIF
>
> CASE m.lcChar >= 8
> IF m.lcChar >= 8
> ThisForm.Pw1_Shape_8.BackColor = RGB(0,255,0)
> ELSE
> ThisForm.Pw1_Shape_8.BackColor = RGB(163,5,29)
> endif
>
> Endcase
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform