Enable hash stored values on grids (on add and update operations)

QuestionsEnable hash stored values on grids (on add and update operations)
Alberto asked 1 month ago

Hello, I need to be able to store values using hash values on grids, and also be able to update them.

Like the md5 option you already have.

Thank you!

1 Answers
Abu answered 4 weeks ago

Hi,

If use md5 in on_update or on_insert callbacks, like:

$data["params"]["password"] = md5($data["params"]["password"]);

To replace md5, you can use following:

$data["params"]["password"] = password_hash($data["params"]["password"],PASSWORD_DEFAULT);

This will save the hash in the database.

In order to verify the hash, you need to call passport_verify function:

$pass_hash contains the hash from database and $password contains the user posted password:

if (password_verify($password, $pass_hash))
{ echo "valid"; }

More details here: https://www.phpmentoring.org/blog/php-password-verify-function

Your Answer

2 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?