Sentinel\Repositories\User\SentryUserRepository::changePasswordWithoutCheck PHP 메소드

changePasswordWithoutCheck() 공개 메소드

Change a user's password without checking their old password first
public changePasswordWithoutCheck ( $data ) : Sentinel\DataTransferObjects\FailureResponse | Sentinel\DataTransferObjects\SuccessResponse
$data
리턴 Sentinel\DataTransferObjects\FailureResponse | Sentinel\DataTransferObjects\SuccessResponse
    public function changePasswordWithoutCheck($data)
    {
        try {
            $user = $this->sentry->getUserProvider()->findById($data['id']);
            // Set the new password (Sentry will hash it behind the scenes)
            $user->password = e($data['newPassword']);
            if ($user->save()) {
                // User saved
                $this->dispatcher->fire('sentinel.user.passwordchange', ['user' => $user]);
                return new SuccessResponse(trans('Sentinel::users.passwordchg'), ['user' => $user]);
            }
            // User not Saved
            return new FailureResponse(trans('Sentinel::users.passwordprob'), ['user' => $user]);
        } catch (UserNotFoundException $e) {
            $message = trans('Sentinel::sessions.invalid');
            return new ExceptionResponse($message);
        }
    }