コード例 #1
0
 /**
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute(DomainListener $listener)
 {
     $user = $this->auth->user();
     $domains = $this->repository->listOfDomains($user->id);
     $this->log->info('Show Domains');
     return $listener->view('domains.index', compact('domains'));
 }
コード例 #2
0
 /**
  * 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');
 }
コード例 #3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return new RedirectResponse(url('/'));
     }
     return $next($request);
 }
コード例 #4
0
 /**
  * Default Page
  * @param \Illuminate\Contracts\Auth\Authenticator $auth
  * @return \Illuminate\View\View
  */
 public function defaultPage(Authenticator $auth)
 {
     if ($auth->check()) {
         return $this->redirect();
     }
     return view('pages.default');
 }
 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);
 }
コード例 #6
0
 /**
  * @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);
 }
コード例 #7
0
 /**
  * @param $domainData
  * @param DomainListener $listener
  * @return Redirect
  */
 public function execute($domainData, DomainListener $listener)
 {
     $user = $this->auth->user();
     $domainData['shortName'] = $domainData['name'];
     $domain = $this->repository->createDomain($user->id, $domainData);
     $this->storeNginxConfig($domain);
     $this->log->info('Domain Created', $domain->toArray());
     return $listener->domainRedirect($domain);
 }
コード例 #8
0
ファイル: AuthFilter.php プロジェクト: devLopez/espresso
 /**
  * Run the request filter.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return mixed
  */
 public function filter(Route $route, Request $request)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return $this->response->make('Unauthorized', 401);
         } else {
             return $this->response->redirectGuest('auth/login');
         }
     }
 }
コード例 #9
0
ファイル: AuthMiddleware.php プロジェクト: CodeWire/larapress
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return $this->response->make('Unauthorized', 401);
         } else {
             return $this->response->redirectGuest('auth/login');
         }
     }
     return $next($request);
 }
コード例 #10
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @param \Illuminate\Contracts\Auth\Authenticator $auth
  * @return bool
  */
 public function authorize(Authenticator $auth)
 {
     return $auth->check();
 }
コード例 #11
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     return $this->auth->basic() ?: $next($request);
 }
コード例 #12
0
 /**
  * Log the user out of the application.
  *
  * @return Response
  */
 public function getLogout()
 {
     $this->auth->logout();
     return redirect('/');
 }
コード例 #13
0
ファイル: BasicAuthFilter.php プロジェクト: devLopez/espresso
 /**
  * Run the request filter.
  *
  * @return mixed
  */
 public function filter()
 {
     return $this->auth->basic();
 }
コード例 #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param \Illuminate\Contracts\Auth\Authenticator $auth
  * @internal param int $id
  * @return Response
  */
 public function destroy(Authenticator $auth)
 {
     $auth->logout();
     return redirect()->home();
 }
コード例 #15
0
ファイル: GuestFilter.php プロジェクト: devLopez/espresso
 /**
  * Run the request filter.
  *
  * @return mixed
  */
 public function filter()
 {
     if ($this->auth->check()) {
         return new RedirectResponse(url('/'));
     }
 }
コード例 #16
0
 /**
  * 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();
 }