/**
  * Handle a registration request for the application.
  *
  * @param  RegisterRequest $request
  * @return Response
  */
 public function postRegister(RegisterRequest $request)
 {
     // Registration form is valid, create user...
     $user = App\User::create($request->all());
     $this->auth->login($user);
     return redirect('/');
 }
 /**
  * @param boolean $hasCode
  * @param AuthenticateUserListener $listener
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function execute($hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst();
     }
     $user = $this->users->findByUsernameOrCreate($this->getGithubUser());
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
 /**
  * Handle a registration request for the application.
  *
  * @param  RegisterRequest     $request
  * @param \App\User\Repository $repository
  *
  * @return Response
  */
 public function postRegister(RegisterRequest $request, UserRepository $repository)
 {
     // Create a new user record.
     //
     $user = $repository->create($request->get('email'), $request->get('passsord'));
     // Log the user into their account.
     //
     $this->auth->login($user);
     // Redirect the user.
     //
     return redirect('/');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param RegisterRequest $request
  * @param Authenticator   $auth
  * @return Response
  */
 public function store(RegisterUserRequest $request, Authenticator $auth)
 {
     $user = $this->execute($request);
     $auth->login($user);
     Flash::message('Glad to have you as a new Larabook member!');
     return redirect()->route('home');
 }
 function it_creates_a_user_if_authorization_is_granted(Factory $socialite, UserRepository $users, Authenticator $auth, User $user, AuthenticateUserListener $listener)
 {
     $socialite->driver('github')->willReturn(new ProviderStub());
     $users->findByUsernameOrCreate(ProviderStub::$data)->willReturn($user);
     $auth->login($user, self::HAS_CODE)->shouldBeCalled();
     $listener->userHasLoggedIn($user)->shouldBeCalled();
     $this->execute(self::HAS_CODE, $listener);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param \Codeboard\Http\Requests\Auth\RegisterRequest $request
  * @param \Codeboard\Repositories\UserRepository $repository
  * @param \Illuminate\Contracts\Auth\Authenticator $auth
  * @return Response
  */
 public function store(RegisterRequest $request, UserRepository $repository, Authenticator $auth)
 {
     $user = $repository->createNewUser($request->all());
     $auth->login($user);
     return redirect()->home();
 }