本文整理汇总了PHP中Illuminate\Contracts\Encryption\Encrypter类的典型用法代码示例。如果您正苦于以下问题:PHP Encrypter类的具体用法?PHP Encrypter怎么用?PHP Encrypter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Encrypter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: date
function it_fails_with_string(Encrypter $encrypter, Request $request)
{
$time = date("Y-m-d H:i:s", strtotime("30 seconds ago"));
$request->get('_guard_opened')->willReturn($time);
$encrypter->decrypt($time)->willReturn($time);
$this->validate($request)->shouldReturn(false);
}
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:7,代码来源:SpamTimerValidatorSpec.php
示例2: time
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);
}
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:7,代码来源:SpamTimerSpec.php
示例3: handle
/**
* 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;
}
开发者ID:AkibaTech,项目名称:users-module,代码行数:14,代码来源:GetResetPasswordPath.php
示例4: onReady
/**
* Fired just before building.
*
* @param Encrypter $encrypter
* @param Request $request
*/
public function onReady(Encrypter $encrypter, Request $request)
{
if ($code = $request->get('code')) {
array_set($this->parameters, 'code', $encrypter->decrypt($code));
}
if ($email = $request->get('email')) {
array_set($this->parameters, 'email', $encrypter->decrypt($email));
}
}
开发者ID:jacksun101,项目名称:users-module,代码行数:15,代码来源:ResetPasswordFormCriteria.php
示例5: handle
/**
* 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'));
});
}
开发者ID:ruysu,项目名称:laravel-core,代码行数:16,代码来源:SendActivationEmail.php
示例6: locationUpdate
/**
* 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()));
}
开发者ID:Charu91,项目名称:Wowtables1,代码行数:18,代码来源:AdminLocationsController.php
示例7: handle
/**
* Handle the command.
*
* @param UserRepositoryInterface $users
* @param UserActivator $activator
* @param Encrypter $encrypter
* @param Request $request
* @return bool
*/
public function handle(UserRepositoryInterface $users, UserActivator $activator, Encrypter $encrypter, Request $request)
{
$code = $request->get('code');
$email = $request->get('email');
if (!$code || !$email) {
return false;
}
$code = $encrypter->decrypt($code);
$email = $encrypter->decrypt($email);
if (!($user = $users->findByEmail($email))) {
return false;
}
return $activator->activate($user, $code);
}
开发者ID:jacksun101,项目名称:users-module,代码行数:23,代码来源:HandleActivateRequest.php
示例8: getActivate
/**
* Activate a user by token
* @param string $token
* @param Request $request
* @param Events $events
* @return Illuminate\Http\Response
*/
public function getActivate(Encrypter $encrypter, Request $request, Events $events, $token)
{
try {
$data = json_decode($encrypter->decrypt($token));
if (is_object($data) && isset($data->id) && is_numeric($data->id) && isset($data->expires) && with(new Carbon(date('Y-m-d H:i:s', $data->expires)))->gt(Carbon::now())) {
$user = $this->activateUser($data->id);
$events->fire(new UserActivated($user));
return $this->userWasActivated($data->id);
} else {
throw new Exception("Invalid token");
}
} catch (Exception $e) {
return $this->userWasNotActivated();
}
}
开发者ID:ruysu,项目名称:laravel-core,代码行数:22,代码来源:ActivatesUsers.php
示例9: index
/**
* Display a listing of the resource.
*
* @param Encrypter $encrypter
* @param $hash
* @return Response
* @throws Exception
*/
public function index(Encrypter $encrypter, $hash)
{
try {
$params = $encrypter->decrypt($hash);
$project = $this->projectRepository->find($params['project']);
$user = $project->users->find($params['user']);
if (is_null($user)) {
throw new Exception('the user was not found');
}
$sourceClass = app()->make('Knoters\\Services\\Sources\\' . ucfirst($project->type->name) . 'Service');
$video = $sourceClass->getVideo($project->video_id);
$this->fractal->setSerializer(new ArraySerializer());
JavaScriptFacade::put(['user' => $this->fractal->createData(new Item($user, new UserTransformer()))->toArray(), 'project' => $this->fractal->createData(new Item($project, new ProjectTransformer()))->toArray()]);
return view('editor', ['video' => $video, 'project' => $project]);
} catch (Exception $e) {
throw $e;
$this->errorResponse($e);
}
}
开发者ID:kife-design,项目名称:knoters,代码行数:27,代码来源:EditorController.php
示例10: loginView
/**
* The login View
*
* @return Response
*/
public function loginView(Encrypter $encrypter)
{
$token = $encrypter->encrypt(csrf_token());
return view('admin.login', ['_token' => $token]);
}
开发者ID:Charu91,项目名称:Wowtables1,代码行数:10,代码来源:AdminController.php
示例11: locations
/**
* 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]);
}
开发者ID:Charu91,项目名称:Wowtables1,代码行数:11,代码来源:AdminSettingsController.php
示例12: handle
/**
* 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}";
}
开发者ID:jacksun101,项目名称:users-module,代码行数:12,代码来源:GetResetPasswordPath.php
示例13: getData
/**
* 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];
}
开发者ID:kife-design,项目名称:knoters,代码行数:12,代码来源:SourceCreatedMailer.php
示例14: decryptArray
/**
* Decrypt an array based cookie.
*
* @param array $cookie
* @return array
*/
protected function decryptArray(array $cookie)
{
$decrypted = array();
foreach ($cookie as $key => $value) {
$decrypted[$key] = $this->encrypter->decrypt(urldecode($value));
}
return $decrypted;
}
开发者ID:WebDevBren,项目名称:TwoStream,代码行数:14,代码来源:DecryptCookies.php
示例15: tokensMatch
/**
* Determine if the session and input CSRF tokens match.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function tokensMatch($request)
{
$token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
$token = $this->encrypter->decrypt($header);
}
return Str::equals($request->session()->token(), $token);
}
开发者ID:alvarobfdev,项目名称:LaravelCore,代码行数:14,代码来源:VerifyCsrfToken.php
示例16: tokensMatch
/**
* Determine if the session and input CSRF tokens match.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function tokensMatch($request)
{
// Get tokens from session and the request
$sessionToken = $request->session()->token();
$token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
$token = $this->encrypter->decrypt($header);
}
if (!is_string($sessionToken) || !is_string($token)) {
return false;
}
// Validate them
return hash_equals((string) $request->session()->token(), (string) $token);
}
开发者ID:influendo,项目名称:laravel-survivor,代码行数:20,代码来源:SurvivorController.php
示例17: validate
/**
* Validate the request.
*
* @param \Illuminate\Http\Request $request
* @param array $params
* @return bool
*/
public function validate($request, $params = [])
{
$this->params = $params;
try {
$timeOpened = $this->encrypter->decrypt($request->get('_guard_opened'));
} catch (DecryptException $e) {
return false;
}
if (!is_numeric($timeOpened)) {
return false;
}
$timeElapsed = time() - $timeOpened;
$tooFast = $timeElapsed < $this->getMinTime();
$tooSlow = $timeElapsed > $this->getMaxTime();
return !$tooFast && !$tooSlow;
}
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:23,代码来源:SpamTimerValidator.php
示例18: encrypt
/**
* 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;
}
开发者ID:GeorgeShazkho,项目名称:micros-de-conce,代码行数:13,代码来源:EncryptCookies.php
示例19: encrypt
/**
* 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;
}
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:16,代码来源:EncryptCookies.php
示例20: incrementOrDecrement
/**
* 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))]);
}
}
}
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:19,代码来源:DatabaseStore.php
注:本文中的Illuminate\Contracts\Encryption\Encrypter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论