FMMacca Posted February 25, 2007 Share Posted February 25, 2007 Hello ASP PRO's,Im having real trouble with some new code I have. I have ASP pages and a MS Access database, when a user signs-up, they get sent their username and password to their email account, I can see in the access database that the entry is correct but when the user tries to sign in with the account they get a;Error: Invalid PasswordThe password you entered was incorrect.Obviously I've made sure the username and password is correct, but no matter what I do, no one is able to sign-in, here is the code where I think its all going wrong; 'Make sure password is correctCheckPass = Request("pwd")If LCase(Request.ServerVariables("PATH_TRANSLATED")) <> LCase(GamePath & "\members\verifylogin.asp") Then CheckPass = Decrypt(CheckPass)End IfIf CheckPass <> Returned("Password") Then Error "Invalid Password", "The password you entered was incorrect."End IfCheckPass = Encrypt(Returned("Password")) Any info would be appreciated. Link to comment Share on other sites More sharing options...
pulpfiction Posted February 26, 2007 Share Posted February 26, 2007 Not sure what Returned("Password") would return. will be helpful, If you could post the code for that function too Link to comment Share on other sites More sharing options...
jesh Posted February 26, 2007 Share Posted February 26, 2007 You might also verify that your pages can connect to the database. The code might be functioning correctly, it just may be that your website cannot get the data from the database the way it's currently set up. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 27, 2007 Share Posted February 27, 2007 Debug man, debug. 'Make sure password is correctCheckPass = Request("pwd")Response.Write("CheckPass: " & CheckPass & "<br>")If LCase(Request.ServerVariables("PATH_TRANSLATED")) <> LCase(GamePath & "\members\verifylogin.asp") Then CheckPass = Decrypt(CheckPass) Response.Write("Decrypting CheckPass<br>")Else Response.Write("CheckPass was not decrypted<br>")End IfResponse.Write("CheckPass now: " & CheckPass & "<br>")Response.Write("Returned(Password): " & Returned("Password") & "<br>")If CheckPass <> Returned("Password") Then Error "Invalid Password", "The password you entered was incorrect."End IfCheckPass = Encrypt(Returned("Password")) Link to comment Share on other sites More sharing options...
FMMacca Posted February 27, 2007 Author Share Posted February 27, 2007 Thanks for the debug code justsomeguy. I used it and got the below;CheckPass: testingDecrypting CheckPassCheckPass now: ttQX5l0Returned(Password): testingError: Invalid PasswordThe password you entered was incorrect.password is EXACTLY as what is in the database! Link to comment Share on other sites More sharing options...
justsomeguy Posted February 27, 2007 Share Posted February 27, 2007 I believe you. Here is your problem:CheckPass now: ttQX5l0Returned(Password): testing If CheckPass <> Returned("Password") Then Clearly "ttQX5l0" is not the same as "testing", so that's why the message is appearing. Either do not decrypt (actually that is encrypting the password) the password, or do the same thing to the Returned("Password") that you do with the original. But if you compare the encrypted version with the original, it won't be the same. Link to comment Share on other sites More sharing options...
FMMacca Posted February 28, 2007 Author Share Posted February 28, 2007 OH ok, got you.So, I removed the line "CheckPass = Decrypt(CheckPass)" from the code but doesnt this mean that the password will now not be encrypted? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 28, 2007 Share Posted February 28, 2007 Yes, it does. Either encrypt both passwords or encrypt neither, but you can't encrypt only one and then check them. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now