Pregunta

I have a form to allow a user to edit their details however the password associated to the user model is hashed. What is the best way to unhash this so I can add it to the form?

// get user
$user = ORM::factory('user', $id);

// in the form
<input id="password" type="password" name="password" value="<?php echo $user->password; ?>" />
¿Fue útil?

Solución

You can't unhash a hash. That's the point of the hash. This is a bad idea. You should never repopulate or email someone their password.

Otros consejos

Think of a hashed password as a one way street. It is okay to go down it one way but not the opposite way. I also agree with zombor that this is a bad practice.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top