Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Verification Problem

Status
Not open for further replies.

RushiShroff

Programmer
Jan 23, 2002
216
IN
Here I am using Access 2000 as my db.I have a password field in my table Users in database.

Now while giving check if user has filled correct login and password it creates problem with ignoring trailing spaces with the password.iT IS HAPPENING FOR loginid too.

If spaces are at begining,it checks fine but trailing spaces it ignores.

What should I do except client side space tracking through javascript ?

Rushi@emqube.com
 
If I have to trim it,it is meaningless for me.
If user puts spaces intentionally or unintentionally,
I have to tell him that it is a bad login.

So Name & Spaces should not be validated by SQL query.
How to do that ?

Rushi@emqube.com
 
If you want the spaces to be allowed for the password, then it should work using the password field as a CStr() comparison. If you don't want leading or trailing spaces to be allowed, it doesn't have to go back to the user as a bad login...

During their signup process, when you get the value from the password field, Trim() the request thereby removing leading and trailing spaces from being entered into the db.

When you are requesting the password field for logging into the site, Trim() again and the leading and trailing spaces will be removed and the passwords will match. -Ovatvvon :-Q
 
No dear Ovatvvon ,
You are right at the point while Sign up,I can trim spaces and store them in db.Atleast I can alert my user that he has entered spaces so continue or Not.

If we allow spaces then let him enter spaces.Or we can trim
them and notify the user about the trimming process.

But when he logs in,he must be carefull while entering CORRECT password,If spaces are there then he should enter spaces.

BUT If he makes a mistake here and puts wrong password(with or without spaces),I must tell him that it is bad login.

That I can achieve by StrComp function.

If(StrComp,UserEnteredPassword,PasswordInDB,0)<> 0
-->>Show error message.
end If

This is the way to achive.I later knew.

Regards,
Rushi@emqube.com

 
as I said, it depends one whether you want to allow leading and trailing spaces. This has nothing to do with spaces inside the text, it will not matter if the user enters spaces before or after in either case as long as your coding process is the same for the signup and for the login. Even if the user put two spaces leading the rest of the password when he signed up and enters it every time when he logs in, it won't matter if you're trimming it...but that depends on your environment. But it seams you have found an answer to your problem otherwise I suspect you would have continued with another question or reiterating the current one...so in that case, glad you solved your problem. :)
-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top