This commit is contained in:
denisdulici 2018-01-03 19:07:29 +03:00
parent 411de05efd
commit f269d3c286
2 changed files with 21 additions and 5 deletions

View File

@ -3,10 +3,10 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
class Reset extends Controller
{
@ -56,8 +56,8 @@ class Reset extends Controller
// database. Otherwise we will parse the error and return the response.
$response = $this->broker()->reset(
$this->credentials($request), function ($user, $password) {
$this->resetPassword($user, $password);
}
$this->resetPassword($user, $password);
}
);
// If the password was successfully reset, we will redirect the user back to
@ -68,6 +68,23 @@ class Reset extends Controller
: $this->sendResetFailedResponse($request, $response);
}
/**
* Reset the given user's password.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $password
* @return void
*/
protected function resetPassword($user, $password)
{
$user->forceFill([
'password' => $password,
'remember_token' => Str::random(60),
])->save();
$this->guard()->login($user);
}
/**
* Get the response for a successful password reset.
*

View File

@ -6,7 +6,6 @@ use App\Notifications\Auth\Reset;
use Date;
use EloquentFilter\Filterable;
use GuzzleHttp\Exception\RequestException;
use Hash;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@ -126,7 +125,7 @@ class User extends Authenticatable
*/
public function setPasswordAttribute($value)
{
$this->attributes['password'] = Hash::make($value);
$this->attributes['password'] = bcrypt($value);
}
/**