protected function makeResponse(Request $request) { $message = $this->translator->get('c::auth.login-required'); if ($request->ajax() || $request->isJson() || $request->wantsJson()) { return Response::json(['error' => $message], 403); } else { $url = $this->url->action('anlutro\\Core\\Web\\AuthController@login'); $intended = $request->getMethod() == 'GET' ? $request->fullUrl() : ($request->header('referer') ?: '/'); $this->session->put('url.intended', $intended); return $this->redirect->to($url)->with('error', $message); } }
/** * @param AccountManager $manager * @param Store $session * @return \Illuminate\Contracts\View\View * @throws \Exception */ public function index(AccountManager $manager, Store $session) { $account = $manager->account(); $contact = $account->contactInformation->first(); $success = $session->get('success'); return $this->theme->render('contact.' . $this->theme->setting('contactLayout'), ['contact' => $contact, 'success' => $success]); }
/** * Should give the fallback string when old input is not present. */ public function testOldInputOrWithoutOldInput() { $fieldName = $this->generator()->anyString(); $this->sessionStore->shouldReceive('getOldInput')->andReturn([$fieldName => []]); $fallbackValue = $this->generator()->anyString(); $this->assertSame($fallbackValue, $this->replyComposer->oldInputOr($fieldName, $fallbackValue)); }
/** * Handle the event. */ public function handle(Store $session) { /* @var MessageBag $errors */ if ($errors = $session->get($this->builder->getOption('prefix') . 'errors')) { $this->builder->setFormErrors($errors); } }
public function __construct($config = [], SessionStore $session) { if (is_array($config['ttwitter::config'])) { $this->tconfig = $config['ttwitter::config']; } else { if (is_array($config['ttwitter'])) { $this->tconfig = $config['ttwitter']; } else { throw new Exception('No config found'); } } $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false; $this->parent_config = []; $this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY']; $this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET']; $this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN']; $this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET']; if ($session->has('access_token')) { $access_token = $session->get('access_token'); if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) { $this->parent_config['token'] = $access_token['oauth_token']; $this->parent_config['secret'] = $access_token['oauth_token_secret']; } } $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL']; $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION; $config = array_merge($this->parent_config, $this->tconfig); parent::__construct($this->parent_config); }
/** * @return MessageBag */ private function oldInput() { if (!isset($this->oldInput)) { $this->oldInput = new MessageBag((array) $this->sessionStore->getOldInput()); } return $this->oldInput; }
/** * Handle the event. * * @param Store $session */ public function handle(Store $session) { /* @var FieldType $field */ foreach ($this->builder->getFormFields() as $field) { $session->flash($field->getFieldName(), $field->getPostValue()); } }
/** * Validate what is passed into the age gate * * @param array $data * @return $this|Validation|\Illuminate\Http\RedirectResponse */ public function validate(array $data) { $this->validation = $this->validator->make($data, $this->getValidationRules(), $this->getValidationMessages()); if ($this->validation->fails()) { $failed = $this->validation->failed(); $validExceptTooYoung = array_get($failed, 'dob.Before'); $canTryAgain = config('laravel-avp.can_try_again'); $toRedirect = config('laravel-avp.redirect_on_error'); $redirectURL = config('laravel-avp.redirect_url'); if (substr($data['dob'], 0, 4) > date('Y')) { return redirect()->action('AVPController@agegate')->withErrors($this->validation->messages())->withInput(); } else { if ($validExceptTooYoung && $toRedirect) { return redirect($redirectURL); } else { if ($validExceptTooYoung && !$canTryAgain) { $this->session->put('laravel-avp.previous_too_young', true); } else { $this->session->keep('url.intended'); } } } return redirect()->action('AVPController@agegate')->withErrors($this->validation->messages())->withInput(); } return $this->setCookie($data['remember']); }
/** * Store the messages in the current session. */ public function flash() { if (static::$session) { static::$session->flash($this->getSessionKey(), $this); } return $this; }
/** * Handle the event. */ public function handle() { if (!$this->config->get('app.debug') && !$this->session->get(__CLASS__ . 'warned') && $this->request->path() == 'admin/dashboard' && $this->modules->get('anomaly.module.installer')) { $this->session->set(__CLASS__ . 'warned', true); $this->messages->error('streams::message.delete_installer'); } }
public function getUser() { if ($this->user == false) { $this->user = $this->session->get("sharp_user"); } return $this->user; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if (!$this->session->has('customer_id')) { return redirect()->to('admin'); } return $next($request); }
/** * Setup the flash messsage data. * * @param string $message * @param string $title * @param string $level */ protected function message($message, $title = '', $type = 'info') { $this->message = $message; $this->title = $title; $this->type = $type; $this->session->flash($this->namespace, (array) $this); }
/** * This is what happens, wenn the detection passes * * @param $lookup * * @return mixed */ protected function handleDetectionComplete($lookup) { debugger()->info('Language detected: ' . $this->detected->slug); Cookie::queue($this->keys['cookie'], $this->detected->slug); $this->session->set($this->keys['session'], $this->detected->slug); $this->config->set('app.locale', $this->detected->slug); return $this->detected; }
public function __construct(Store $session, $messages = array()) { $this->session = $session; if ($session->has($this->session_key)) { $messages = array_merge_recursive($session->get($this->session_key), $messages); } parent::__construct($messages); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->session->has($this->sessionKey)) { $this->googleTagManager->set($this->session->get($this->sessionKey)); } $response = $next($request); $this->session->flash($this->sessionKey, $this->googleTagManager->getFlashData()); return $response; }
/** * @param Store $session * @param Request $request * @param AccountManager $accounts * @return \Illuminate\Http\RedirectResponse */ public function locale(Store $session, Request $request, AccountManager $accounts) { $account = $accounts->account(); if ($request->has('locale') && $this->is_account_locale($account, $request->get('locale'))) { $session->set('locale', $request->get('locale')); return redirect()->to('/' . $request->get('locale')); } return redirect()->to(store_route('store.home')); }
public function postValidate() { $validator = $this->validator->make($this->input->all(), array('recaptcha_response_field' => 'required|recaptcha')); if ($validator->fails()) { return $this->response->json(array('result' => 'failed')); } $this->session->put('captcha.passed.time', $this->mockably->microtime()); return $this->response->json(array('result' => 'success')); }
/** * @param $message * @param string $level */ public function message($message, $level = 'info') { $notification = new \stdClass(); $notification->message = $message; $notification->level = $level; $notifications = $this->session->get('flash_notifications', []); array_push($notifications, $notification); $this->session->flash('flash_notifications', $notifications); }
/** * Class constructor. * * @param Illuminate\Html\FormBuilder $builder * @param Illuminate\Http\Request $request * @param Illuminate\Session\Store $session */ public function __construct(Builder $builder, Request $request, Session $session) { $this->builder = $builder; $this->request = $request; $this->fields = new FieldCollection(); $this->fields->setNamespace($this->namespace); $this->fields->setBuilder($this->builder); $this->fields->setErrorBag($session->has('errors') ? $session->get('errors')->getBag($this->namespace) : new MessageBag()); }
/** * Authenticate to a protected snippet. * * @param Url $url * @param \Illuminate\Http\Request $request * @param \Illuminate\Session\Store $session * @return \Illuminate\Http\RedirectResponse */ public function authenticate(Url $url, Request $request, Store $session) { if (!$url->authenticate($request->input('password'))) { flash()->warning('Wrong password'); return redirect()->back(); } $session->flash('urls_auth', true); return redirect()->route('urls.show', $url->slug->slug); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); if ($this->isCacheable($request)) { $uri = $request->getUri(); $this->store->put($this->sessionKey, $uri); } return $response; }
/** * Class constructor * * @param \Illuminate\Html\HtmlBuilder $html * @param \Illuminate\Routing\UrlGenerator $url * @param \Illuminate\Session\Store $session * @param \Illuminate\Config\Repository $config */ public function __construct(HtmlBuilder $html, UrlGenerator $url, Session $session, Config $config) { $this->url = $url; $this->html = $html; $this->csrfToken = $session->getToken(); $this->config = $config; $this->loadConfig(); $this->session = $session; $this->errors = $session->get('errors'); }
/** * * THIS IS PRETTY SHIT BUT I'VE GOT STUFF TO DO YO * * Handle a registration request for the application. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function register(Request $request, Session $session) { $session->flash("authRoute", 'register'); $validator = $this->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } Auth::guard($this->getGuard())->login($this->create($request->all())); return redirect($this->redirectPath()); }
/** * Processes the date of birth submitted in the age gate form */ public function doAgegate() { $previousTooYoung = $this->session->get('laravel-avp.previous_too_young'); if ($previousTooYoung) { return $this->{$redirector}->action('FWM\\LaravelAVP\\AVPController@agegate'); } // Get the date of birth that the user submitted $dob = $this->handler->processDataOfBirth(); return $this->validation->validate($dob); }
/** * Allows you retrieve the most recent social provider * authorized with. * * @return mixed */ public function getRecentAuthData() { $providers = $this->session->get('__sp_auth.p'); if (!$providers) { return null; } return array_first($providers, function ($provider) { return $provider === $this->session->get('__sp_auth.r'); }); }
/** * @return array */ public function processDataOfBirth() { // Get the date of birth that the user submitted $dob = null; if ($this->request->has('dob')) { // field name is dob when using input type date $dob = $this->request->get('dob'); } elseif ($this->request->has('dob_year') && $this->request->has('dob_month') && $this->request->has('dob_day')) { // field name has _year, _month and _day components if input type select $dob = $this->request->get('dob_year') . '-' . $this->request->get('dob_month') . '-' . $this->request->get('dob_day'); } $remember_me = false; if ($this->request->get('remember_me') == "on") { $this->session->set('remembered_day', $this->request->get('dob_day')); $this->session->set('remembered_month', $this->request->get('dob_month')); $this->session->set('remembered_year', $this->request->get('dob_year')); $this->session->set('remember_me', "on"); $remember_me = true; } else { $this->session->remove('remembered_day'); $this->session->remove('remembered_month'); $this->session->remove('remembered_year'); $this->session->remove('remember_me'); } // return in an array for validator return ['dob' => $dob, 'remember' => $remember_me]; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!$this->auth->user()->isConfirmed()) { // Don't let people who haven't confirmed their email use the authed sections on the website. $this->session->put('error', 'Please confirm your email address (' . $this->auth->user()->email . ') before you try to use this section. <a style="color:#fff" href="' . route('auth.reconfirm') . '">Re-send confirmation email.</a> <a href="' . route('user.settings', $this->auth->user()->name) . '" style="color:#eee;">Change e-mail address.</a>'); return redirect()->home(); } return $next($request); }
/** * Check if the reCAPTCHA is required * * @return bool Returns true if the captcha is required */ public function isRequired() { if (!$this->config->get('larapress.settings.captcha.active')) { return false; } $timer = $this->config->get('larapress.settings.captcha.timer'); if ($this->helpers->getCurrentTimeDifference($this->session->get('captcha.passed.time', 0), 'm') >= $timer) { return true; } return false; }
/** * Retrieve a user by the given credentials. * * @param array $credentials * @return \Illuminate\Auth\UserInterface|null */ public function retrieveByCredentials(array $credentials) { $username = $credentials[$this->params['identifier']]; $imap = @\imap_open($this->params['datasource'], $username, $credentials['password']); if (false !== $imap) { $credentials['id'] = $username; $user = new $this->model($credentials); $this->session->set('user.current', $user); return $user; } return null; }