renamed hasher class to hash and hash method to make.
This commit is contained in:
parent
c4aa6e6ba2
commit
d05f4fa0db
|
@ -124,7 +124,7 @@
|
||||||
'Eloquent' => 'Laravel\\Database\\Eloquent\\Model',
|
'Eloquent' => 'Laravel\\Database\\Eloquent\\Model',
|
||||||
'File' => 'Laravel\\File',
|
'File' => 'Laravel\\File',
|
||||||
'Form' => 'Laravel\\Form',
|
'Form' => 'Laravel\\Form',
|
||||||
'Hasher' => 'Laravel\\Security\\Hasher',
|
'Hasher' => 'Laravel\\Security\\Hash',
|
||||||
'HTML' => 'Laravel\\HTML',
|
'HTML' => 'Laravel\\HTML',
|
||||||
'Inflector' => 'Laravel\\Inflector',
|
'Inflector' => 'Laravel\\Inflector',
|
||||||
'Input' => 'Laravel\\Input',
|
'Input' => 'Laravel\\Input',
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
{
|
{
|
||||||
$user = User::where($config['username'], '=', $username)->first();
|
$user = User::where($config['username'], '=', $username)->first();
|
||||||
|
|
||||||
if ( ! is_null($user) and Hasher::check($password, $user->password))
|
if ( ! is_null($user) and Hash::check($password, $user->password))
|
||||||
{
|
{
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php namespace Laravel\Security; use Laravel\Str;
|
<?php namespace Laravel\Security; use Laravel\Str;
|
||||||
|
|
||||||
class Hasher {
|
class Hash {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a password using the Bcrypt hashing scheme.
|
* Hash a password using the Bcrypt hashing scheme.
|
||||||
|
@ -13,17 +13,17 @@ class Hasher {
|
||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* // Create a Bcrypt hash of a value
|
* // Create a Bcrypt hash of a value
|
||||||
* $hash = Hasher::hash('secret');
|
* $hash = Hash::make('secret');
|
||||||
*
|
*
|
||||||
* // Use a specified number of iterations when creating the hash
|
* // Use a specified number of iterations when creating the hash
|
||||||
* $hash = Hasher::hash('secret', 12);
|
* $hash = Hash::make('secret', 12);
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @param int $rounds
|
* @param int $rounds
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function hash($value, $rounds = 8)
|
public static function make($value, $rounds = 8)
|
||||||
{
|
{
|
||||||
return crypt($value, '$2a$'.str_pad($rounds, 2, '0', STR_PAD_LEFT).'$'.static::salt());
|
return crypt($value, '$2a$'.str_pad($rounds, 2, '0', STR_PAD_LEFT).'$'.static::salt());
|
||||||
}
|
}
|
Loading…
Reference in New Issue