/** * @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')); }
/** * 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'); }
/** * 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); }
/** * 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); }
/** * @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); }
/** * @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); }
/** * 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'); } } }
/** * 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); }
/** * 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(); }
/** * 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); }
/** * Log the user out of the application. * * @return Response */ public function getLogout() { $this->auth->logout(); return redirect('/'); }
/** * Run the request filter. * * @return mixed */ public function filter() { return $this->auth->basic(); }
/** * 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(); }
/** * Run the request filter. * * @return mixed */ public function filter() { if ($this->auth->check()) { return new RedirectResponse(url('/')); } }
/** * 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(); }