| View previous topic :: View next topic |
| Author |
Message |
starfire Newbie
Joined: 16 Dec 2008 Posts: 24 Location: Florida USA
|
Posted: Thu Dec 25, 2008 1:58 pm Post subject: Need Three Attempts At Correct Password |
|
|
Hi Everyone,
I did a search on VDSWorld and found some password code that does work for prompting a customer for a password. What can I add to this code to give the customer three attempts at typing in the correct password before it ends?
Title Xform
%%password = password
if @not(@equal(@input(Enter Password To Login.,,PASSWORD),%%password))
info UNAUTHORIZED LOGIN ATTEMPT!!! - Program Terminated
exit
end
I did this and it continues to prompt but it is not the solution I was going for:
Title Xform
:repeat
%%password = password
if @not(@equal(@input(Enter Password To Login.,,PASSWORD),%%password))
info Password Incorrect. Login Failed.
goto repeat
exit
end
Any Suggestions ?
Thanks
Starfire |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Thu Dec 25, 2008 5:25 pm Post subject: |
|
|
Try this...
| Code: | Title Xform
%%Count = 0
%%authenticated = 0
repeat
%%Count = @succ(%%Count)
%%password = password
if @not(@equal(@input(Enter Password To Login.,,PASSWORD),%%password))
info Password Incorrect. Login Failed. @cr()(%%Count) Attempt(s)
else
%%authenticated = 1
%%Count = 3
end
until @equal(%%Count,3)
If @equal(%%authenticated,1)
info Proceed with xForm...
else
info Login attempts exceeded!@cr()@cr()Shutting down...
stop
end
exit |
|
|
| Back to top |
|
 |
starfire Newbie
Joined: 16 Dec 2008 Posts: 24 Location: Florida USA
|
Posted: Thu Dec 25, 2008 7:06 pm Post subject: |
|
|
Very Cool Aslan,
The code you provided works great. Just what I was aiming at to get to work. I did switched around the order for end exit to exit end. It would not work the other way.
By the way. When the customer clicks Cancel Instead of OK after entering the correct or incorrect password is there a way for the code to exit rather than to go to the next attempt?
Thank you from a struggling VDS newbi.
Thanks
Starfire |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Dec 26, 2008 8:56 am Post subject: |
|
|
Hey there!
Try this:
| Code: |
Title Xform
%%Count = 0
%%authenticated = 0
repeat
%%Count = @succ(%%Count)
%%password = password
%%input = @input(Enter Password To Login.,,PASSWORD)
if @null(%%input)
info Login cancelled! Exiting...
goto exit
elsif @not(@equal(%%input,%%password))
info Password Incorrect. Login Failed. @cr()(%%Count) Attempt(s)
else
%%authenticated = 1
%%Count = 3
end
until @equal(%%Count,3)
If @equal(%%authenticated,1)
info Proceed with xForm...
else
info Login attempts exceeded!@cr()@cr()Shutting down...
stop
end
:exit |
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
starfire Newbie
Joined: 16 Dec 2008 Posts: 24 Location: Florida USA
|
Posted: Fri Dec 26, 2008 4:01 pm Post subject: |
|
|
Hey back at you Dr. Dread,
Your suggestion worked out great. I knew there must have been a way to make it work but just could not figure it out in my head and limited experience with VDS.
Thanks
Starfire |
|
| Back to top |
|
 |
|