/** * Check if the given hash has been hashed using the given options. * * @param string $hashedValue * @param array $options * * @return bool */ public function needsRehash($hashedValue, array $options = []) { // Here, we assume the target hasher is smart enough to detect if a // hash does not have the expected format. return $this->targetHasher->needsRehash($hashedValue, $options); }
/** * Run before the command is handled. * * @param Illuminate\Contracts\Hashing\Hasher * @param Cerbero\Auth\Commands\Command $command * @return mixed */ public function before(Hasher $hasher, $command) { if ($hasher->needsRehash($password = $command->attributes['password'])) { $command->attributes['password'] = $hasher->make($password); } }