Always Hash Password

Submitted by HakShinKen - 3 years ago

When you save the password fields, it's been hashed every time. You have to put it in your User model. Thanks to Karl Merkli to add needsRehash

public function setPasswordAttribute($value) 
{
    $this->attributes['password'] = (Hash::needsRehash($value) ? Hash::make($value) : $value);
}

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks