needsRehash() публичный статический Метод

Check if the given hash has been hashed using the given options.
public static needsRehash ( string $hashedValue, array $options = [] ) : boolean
$hashedValue string
$options array
Результат boolean
Пример #1
0
 /**
  * Set the user's password.
  *
  * @param  string  $value
  *
  * @return string
  */
 public function setPasswordAttribute($value)
 {
     if (\Hash::needsRehash($value)) {
         $value = bcrypt($value);
     }
     $this->attributes['password'] = $value;
 }
Пример #2
0
 public static function boot()
 {
     parent::boot();
     static::saving(function ($user) {
         if (Hash::needsRehash($user->password)) {
             $user->password = \Hash::make($user->password);
         }
     });
 }
Пример #3
0
 public function updating($model)
 {
     /** @var \Rgv151\Spratly\User $model */
     if (empty($model->password)) {
         $model->password = $model->getOriginal('password');
     }
     if (Hash::needsRehash($model->password)) {
         $model->password = Hash::make($model->password);
     }
 }
Пример #4
0
 public function fire()
 {
     $string = $this->argument('string');
     $hash = $this->argument('hash');
     if (\Hash::check($string, $hash) === false) {
         $this->error('Compare: not match!');
     } else {
         $this->info('Compare: match!');
     }
     if (\Hash::needsRehash($hash)) {
         $this->info('Your hash needs to be rehashed.');
     }
 }
Пример #5
0
 /**
  * 密码
  * @param  string $value 未处理的密码字符串
  * @return void
  */
 public function setPasswordAttribute($value)
 {
     // 若传入的字符串已经进行了 Hash 加密,则不重复处理
     $this->attributes['password'] = Hash::needsRehash($value) ? Hash::make($value) : $value;
 }
Пример #6
0
 /**
  * Adjuster: Password
  * @param  string $value Untreated password string
  * @return void
  */
 public function setPasswordAttribute($value)
 {
     // If the incoming string has been encrypted Hash, the iterative process is not
     $this->attributes['password'] = Hash::needsRehash($value) ? Hash::make($value) : $value;
 }