he creado un helper con una funcion propia para hashear el password(de nombre CustomHash) y registra bien pero no loguea, siguiendo un tutorial de preguntas similares hice lo siguiente:
Cree una carpeta libraries => App\libraries la cual contiene 2 archivos:
- CustomHasher.php
- CustomHashServiceProvider.php
el archivo CustomHasher.php se ve asi:
<?php
namespace Libraries;
class CustomHasher implements Illuminat\Contracts\Hashing\Hasher {
/**
* Hash the given value.
*
* @param string $value
* @return array $options
* @return string
*/
public function make($value, array $options = array()) {
return hash('customHash', $value);
}
/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @return bool
*/
public function check($value, $hashedValue, array $options = array()) {
return $this->make($value) === $hashedValue;
}
/**
* Check if the given hash has been using the given options.
* @param string $hashedValue
* @param array $options
* @return bool
*/
public function needsRehash($hashedValue, array $options = array()) {
return false;
}
}
El archivo CustomHashServiceProvider.php se ve asi:
<?php
namespace Libraries;
use Libraries\SHAHasher;
use Illuminate\Hashing\HashServiceProvider;
class SHAHashServiceProvider extends Illuminate\Support\ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register() {
$this->app['hash'] = $this->app->share(function () {
return new CustomHasher();
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides() {
return array('hash');
}
}
mi app/helpers.php
<?php
function customHash($value) {
$value = strtoupper(
sha1(
sha1($value, true)
)
);
$value = '*' . $value;
return $value;
}
modifique el composer.json para cargar mis librerias
"autoload": {
"classmap": [
// ...
"app/libraries"
]
},
entonces en App\config\app.php Providers comente:
//'Illuminate\Hashing\HashServiceProvider',
y puse debajo:
'CustomHashServiceProvider',
luego corri en consola
composer dump-autoload
y me tira el siguiente error:
FatalThrowableError in ProviderRepository.php line 146:
Class 'CustomHashServiceProvider' not found
que me falta o que estoy haciendo mal?