quiere que los campos no se guarden encriptados, sino con sus valores originales, para reenviarlos cuando sea olvidada la contraseña. A opinion inicial pienso q es bastante inseguro estom pues cualquier listillo q haga una inyeccion de codigo haciendo un select * from <tabla_usuario>, puede acceder directamente a todas las contraseñas del sistema.
Pero bueno, en la ruta \cake\libs\security.php busca este codigo en la linea 104:
/**
* Create a hash from string using given method.
* Fallback on next available method.
*
* @param string $string String to hash
* @param string $type Method to use (sha1/sha256/md5)
* @param boolean $salt If true, automatically appends the application's salt
* value to $string (Security.salt)
* @return string Hash
* @access public
* @static
*/
function hash($string, $type = null, $salt = false) {
$_this =& Security::getInstance();
if ($salt) {
if (is_string($salt)) {
$string = $salt . $string;
} else {
$string = Configure::read('Security.salt') . $string;
}
}
if (empty($type)) {
$type = $_this->hashType;
}
$type = strtolower($type);
if ($type == 'sha1' || $type == null) {
if (function_exists('sha1')) {
$return = sha1($string);
return $return;
}
$type = 'sha256';
}
if ($type == 'sha256' && function_exists('mhash')) {
return bin2hex(mhash(MHASH_SHA256, $string));
}
if (function_exists('hash')) {
return hash($type, $string);
}
return md5($string);
}
y comentas todo, añadiendo al final el mismo texto de entrada, osea algo como esto:
/**
* Create a hash from string using given method.
* Fallback on next available method.
*
* @param string $string String to hash
* @param string $type Method to use (sha1/sha256/md5)
* @param boolean $salt If true, automatically appends the application's salt
* value to $string (Security.salt)
* @return string Hash
* @access public
* @static
*/
function hash($string, $type = null, $salt = false) {
/*$_this =& Security::getInstance();
if ($salt) {
if (is_string($salt)) {
$string = $salt . $string;
} else {
$string = Configure::read('Security.salt') . $string;
}
}
if (empty($type)) {
$type = $_this->hashType;
}
$type = strtolower($type);
if ($type == 'sha1' || $type == null) {
if (function_exists('sha1')) {
$return = sha1($string);
return $return;
}
$type = 'sha256';
}
if ($type == 'sha256' && function_exists('mhash')) {
return bin2hex(mhash(MHASH_SHA256, $string));
}
if (function_exists('hash')) {
return hash($type, $string);
}
return md5($string);*/
return $string;
}
con eso cada vez q la aplicacion quiera convertir un texto a MD5, SHA-1 o cualquier algoritmo de encriptacion, simplemente no lo hara y devolvera la misma cadena enviada.