This topic is locked

Password Validation

10/29/2007 10:54:38 AM
ASPRunnerPro General questions
L
lonestar author

I hate to keep asking about the same things but here I am again...
I'm trying to validate passwords when someone makes an update to the tbllogin. Basically, I want to force strong passwords for security purposes. However, all my attempts at this have failed. If someone could provide me with a sample of how to do this or could point me in the right direction it'd be greatly appreciated.

Sergey Kornilov admin 10/29/2007

You need to provide more details on this.
What is your understanding of s string password?

How do you like to enforce it?

L
lonestar author 10/29/2007

Ideally, I'd like to require at least 6 characters, a mix of letters and numbers, at least one capital letter, and no special characters. If the password fails to meet this it'd simply inform the user that they need to choose a stronger password.

Sergey Kornilov admin 10/30/2007

The following code can be placed to BeforeRegister event.

Replace "password" with the actual name of the password field.

if len(pass)<6 then

BeforeRegister=false

exit function

end if
pass = dict("password")
dim numbers,specials,i,c

numbers=0

specials=0
for i=1 to len(pass)

c=asc(mid(pass,i,1))

if c>=asc("0") and c<=asc("9") then

numbers=numbers+1

elseif not (c>=asc("a") and c<=asc("z") or c>=asc("A") and c<=asc("Z")) then

specials=specials+1

end if

next
if numbers<1 or specials<1 then

BeforeRegister=false

exit function

end if
BeforeRegister=true

D
DeStRoY 10/30/2007

newbi here...
I'm planning on doing something similar with the real estate template but have no clue about programming this stuff. How would I plug this into the template to make it work?

Sergey Kornilov admin 10/30/2007

This code needs to be placed to BeforeRegister event (Events tab).

Replace "password" with the actual name of the password field.

D
DeStRoY 10/31/2007

This code needs to be placed to BeforeRegister event (Events tab).

Replace "password" with the actual name of the password field.


In the Events Tab there is no BeforeRegister event to add this code to.
In fact, I'm not using a registration page at all. With the RealEstate template users can edit the tbllogin directly. It is there that I need the password validation.
Any ideas?

Sergey Kornilov admin 10/31/2007

I see what you saying.
Use BeforeAdd/BeforeEdit events of tblLogin in this case.
Make sure you replace BeforeRegister function name with BeforeAdd or BeforeEdit respectively.

L
lonestar author 11/1/2007

For this to work you must move

pass = dict("password")
dim numbers,specials,i,c

numbers=0

specials=0


above

if len(pass)<6 then

BeforeRegister=false

exit function

end if
D
DeStRoY 11/2/2007

Everything seems to be working. Thanks for the help!