problem with password validation

Reply

Join Date: Jul 2008
Posts: 50
Reputation: shijunair is an unknown quantity at this point 
Solved Threads: 0
shijunair shijunair is offline Offline
Junior Poster in Training

problem with password validation

 
0
  #1
Aug 26th, 2008
hello,
I just noticed a problem in my code.
hope you'll would help me.
normally we have a login page where the userid and password is validated from database .now the problem what i am facing is

  1. while(rs.next())
  2. {
  3. if((rs.getString("m_emp_no").equals(user)) && (rs.getString("m_password").equals(pwd)) )
  4. {
  5. " " direct to some page
  6. }
  7. else
  8. {
  9. <script language="javascript">
  10. alert("Sorry!Wrong User ID or Password entered.Try Again");
  11. document.f1.action="loginpage"
  12. document.f1.submit();
  13. }
  14. }

now the code is working fine to log in to the main page but when i type any user id or password in the text box then it doesnt direct me to the alert box else it just shows me a blank page.for example if my password is "welcome" in database and i type "Welcome" which is in caps then it prompts me the alert box but if it type "hello123" then it doesnt prompt me the alert box.i really dont understand what is the problem.i even tried with this code
  1. if(rs.next()==true)
  2. {
  3. }
  4. else if(rs.next()==false)
  5. {
  6. javascript
  7. }
here it directs me to the alert box if i put any password wrong, but here the problem is if the password column in database is in caps such as "Welcome" and in the page if i insert "welcome" in lower case still it accepts and direct me to the main page which shouldnt happen.so pls anyone could help me out of this .if the question is not clear pls ask me to send it again.
thanks in advance.
Last edited by peter_budo; Aug 26th, 2008 at 7:46 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 50
Reputation: shijunair is an unknown quantity at this point 
Solved Threads: 0
shijunair shijunair is offline Offline
Junior Poster in Training

Re: problem with password validation

 
-1
  #2
Aug 27th, 2008
Is there no one to help me out of this.I was expecting some help from you people.Anyways i am still waiting for the solution .if any one could help me out, it would be a great favour.
thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: problem with password validation

 
0
  #3
Aug 27th, 2008
  1. while(rs.next())
  2. {
  3. if((rs.getString("m_emp_no").equals(user)) && (rs.getString("m_password").equals(pwd)) )
  4. {
  5. " " direct to some page
  6. }
  7. else
  8. {
  9. <script language="javascript">
  10. alert("Sorry!Wrong User ID or Password entered.Try Again");
  11. document.f1.action="loginpage"
  12. document.f1.submit();
  13. }
  14. }
I notice the following problems :-
  • First no indentations
  • Next I do not know where does this code go, is it inside a servlet or inside a JSP page, either way you should get an error cause you are directly mixing html with java code without appropriate delimiters
  • And the code you are using to redirect you have completely skipped it from what can be seen, which is from your description appears to be where the problem lies.
Last edited by stephen84s; Aug 27th, 2008 at 6:31 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JSP Forum


Views: 1116 | Replies: 2
Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC