Retrieve hashed PHP password from database and check against a submitted password in Javascript -


i have options page in project , in can change password. have form asks enter current password, new password , confirm password. check data errors , send server using jquery ajax.

the problem have need check current password against password stored in database.

the database password hashed using php sha1($database_password.$salt);

i thinking pass php variables, $database_password , $salt javascript somehow , use sha1() js alternative sha1 javascript code see if current password matches database password.

can give me pointers or there alternative ways?

i think it's better leave password hash on server. can ajax request current password , have server validate it. way hash remains unknown user , brute force attack more difficult.

of course should send current password (and new password) once user indicates has finished typing (ie. when clicks submit button).


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -