/** * Handle the command. * * @param Repository $config * @param Encrypter $encrypter * @return string */ public function handle(Repository $config, Encrypter $encrypter) { $email = $encrypter->encrypt($this->user->getEmail()); $code = $encrypter->encrypt($this->user->getResetCode()); $query = "?email={$email}&code={$code}&redirect={$this->redirect}"; return $config->get('anomaly.module.users::paths.reset') . $query; }
/** * Encrypt the cookies on an outgoing response. * * @param \Symfony\Component\HttpFoundation\Response $response * @return \Symfony\Component\HttpFoundation\Response */ protected function encrypt(Response $response) { foreach ($response->headers->getCookies() as $key => $cookie) { $response->headers->setCookie($this->duplicate($cookie, $this->encrypter->encrypt($cookie->getValue()))); } return $response; }
/** * The data that is needed in the view * * @return mixed */ public function getData() { $params = ['project' => $this->user->pivot->project_id, 'user' => $this->user->id]; $userHash = $this->encrypter->encrypt($params); $url = env('BASE_URL', 'http://knoters.com') . '/editor/' . $userHash; return ['url' => $url]; }
function it_returns_the_timer_html(Encrypter $encrypter) { $time = time(); $encrypter->encrypt($time)->willReturn($time); $html = (require __DIR__ . "/../../../src/Html/templates/timer.php"); $this->html()->shouldReturn($html); }
/** * Encrypt the cookies on an outgoing response. * * @param \Symfony\Component\HttpFoundation\Response $response * @return \Symfony\Component\HttpFoundation\Response */ protected function encrypt(Response $response) { foreach ($response->headers->getCookies() as $cookie) { if ($this->isDisabled($cookie->getName())) { continue; } $response->headers->setCookie($this->duplicate($cookie, $this->encrypter->encrypt($cookie->getValue()))); } return $response; }
/** * Execute the job. * * @param Mailer $mailer * @return void */ public function handle(Mailer $mailer, Encrypter $encrypter) { app()->setLocale($this->locale); $token = $encrypter->encrypt(json_encode(['id' => $this->user->getKey(), 'expires' => time() + 3600 * 72])); $user = $this->user; $mailer->send('core::emails.activate', compact('user', 'token'), function ($message) use($user) { $message->to($user->email); $message->subject(trans('core::auth.emails.activate.subject')); }); }
/** * Increment or decrement an item in the cache. * * @param string $key * @param mixed $value * @param \Closure $callback * @return void */ protected function incrementOrDecrement($key, $value, Closure $callback) { $prefixed = $this->prefix . $key; $cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first(); if (!is_null($cache)) { $current = $this->encrypter->decrypt($cache->value); if (is_numeric($current)) { $this->table()->where('key', $prefixed)->update(['value' => $this->encrypter->encrypt($callback($current))]); } } }
/** * Set a given setting value. * * @param string $key * @param mixed $value * @return void */ public function set($key, $value = null) { $this->fire('setting', $key, [$key, $value]); $generatedKey = $this->getKey($key); $serializedValue = $this->serializeValue($value); $this->repository->set($generatedKey, $this->isEncryptionEnabled() ? $this->encrypter->encrypt($serializedValue) : $serializedValue); if ($this->isCacheEnabled()) { $this->cache->forget($generatedKey); } $this->fire('set', $key, [$key, $value]); $this->context(null); }
/** * Fetch the list of Locations * * @Get("/", as="AdminLocationsIndex") */ public function locationUpdate($id, Encrypter $encrypter) { //echo $id; $token = $encrypter->encrypt(csrf_token()); //$locations = DB::table('locations')->where('id', '=', $id)->first(); $query = "SELECT ld.`id` AS `location_id` , ld.`name` AS `location` , ld.`slug` AS `slug` , IF( la.`id` = ld.`id` , '', la.`id` ) AS `parent_id` , IF( la.`id` = ld.`id` , '', la.`name` ) AS `parent` , CAST( ld.type AS CHAR ) AS `location_type`\n FROM locations_tree AS `lt`\n INNER JOIN locations AS `ld` ON lt.`descendant` = ld.`id`\n INNER JOIN locations AS `la` ON lt.`ancestor` = la.`id`\n WHERE (lt.`length` =1 OR ld.`type` = 'Country') AND ld.id = '{$id}'"; $locations = DB::select($query); /*print_r($locations); echo $locations['0']->location_id; exit;*/ return view('admin.settings.locationsupdate', ['_token' => $token, 'locations' => $locations]); //return response()->json($locations->fetch($request->all())); }
/** * Store an item in the cache for a given number of minutes. * * @param string $key * @param mixed $value * @param int $minutes * @return void */ public function put($key, $value, $minutes) { $key = $this->prefix . $key; // All of the cached values in the database are encrypted in case this is used // as a session data store by the consumer. We'll also calculate the expire // time and place that on the table so we will check it on our retrieval. $value = $this->encrypter->encrypt($value); $expiration = $this->getTime() + $minutes * 60; try { $this->table()->insert(compact('key', 'value', 'expiration')); } catch (Exception $e) { $this->table()->where('key', '=', $key)->update(compact('value', 'expiration')); } }
/** * Increment or decrement an item in the cache. * * @param string $key * @param mixed $value * @param \Closure $callback * @return int|bool */ protected function incrementOrDecrement($key, $value, Closure $callback) { return $this->connection->transaction(function () use($key, $value, $callback) { $prefixed = $this->prefix . $key; $cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first(); if (is_null($cache)) { return false; } $current = $this->encrypter->decrypt($cache->value); $new = $callback($current, $value); if (!is_numeric($current)) { return false; } $this->table()->where('key', $prefixed)->update(['value' => $this->encrypter->encrypt($new)]); return $new; }); }
/** * Encrypt payload. * * @return string */ protected function encryptPayload() { $payload = json_encode($this->payload); return $this->encrypter->encrypt($payload); }
/** * Handle the command. * * @return string|null */ public function handle(Encrypter $encrypter) { $email = $encrypter->encrypt($this->user->getEmail()); $code = $encrypter->encrypt($this->user->getActivationCode()); return "/users/activate?email={$email}&code={$code}&redirect={$this->redirect}"; }
/** * Display the locations available for gourmetitup * * @Get("/locations", as="adminSettingsLocations") * @return Response */ public function locations(Encrypter $encrypter) { $token = $encrypter->encrypt(csrf_token()); return view('admin.settings.locations', ['_token' => $token]); }
/** * Put an item into the storage. * * @param string $key * @param string $data * * @return void */ public function put($key, $data) { $this->store->put($key, $this->encrypter->encrypt($data)); }
/** * The login View * * @return Response */ public function loginView(Encrypter $encrypter) { $token = $encrypter->encrypt(csrf_token()); return view('admin.login', ['_token' => $token]); }
/** * Prepare the serialized session data for storage. * * @param string $data * @return string */ protected function prepareForStorage($data) { return $this->encrypter->encrypt($data); }
/** * Handle the command. * * @param Encrypter $encrypter * @return string */ public function handle(Encrypter $encrypter) { $email = $encrypter->encrypt($this->user->getEmail()); $code = $encrypter->encrypt($this->user->getResetCode()); return "/users/password/reset?email={$email}&code={$code}&redirect={$this->redirect}"; }