php - Moodle password check on external script -


i have moodle 2.7. users logins , passwords hashes stored in mdl_user table. want create external script can check - if login , password correct.

as see - moodle version use function php password_hash() generate password hash.

my php version 5.4 can't use function. use library https://github.com/ircmaxell/password_compat code

$password_hash = password_hash( $password , password_default, array()); 

the problem hash different each time calculate it. cant compare hash string placed in mdl_user table.

if function similar of password_hash() native php, salt generated along hash, , salt randomized. because of this, comparing results of 2 separate calls of password_hash() not going match.

the function you're looking password_verify(), takes inputted password , hash on database. if returns true, passwords match.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -