本文整理汇总了PHP中Pagekit\Application::session方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::session方法的具体用法?PHP Application::session怎么用?PHP Application::session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagekit\Application
的用法示例。
在下文中一共展示了Application::session方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginAction
/**
* @Route("/admin/login", defaults={"_maintenance"=true})
*/
public function loginAction()
{
if (App::user()->isAuthenticated()) {
return App::redirect('@system');
}
return ['$view' => ['title' => __('Login'), 'name' => 'system/theme:views/login.php', 'layout' => false], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => App::request()->get('redirect') ?: App::url('@system', [], true), 'remember_me_param' => Auth::REMEMBER_ME_PARAM];
}
示例2: loginAction
/**
* @Route("/admin/login", defaults={"_maintenance"=true})
* @Request({"redirect": "string", "message": "string"})
*/
public function loginAction($redirect = '', $message = '')
{
if (App::user()->isAuthenticated()) {
return App::redirect('@system');
}
return ['$view' => ['title' => __('Login'), 'name' => 'system/theme:views/login.php', 'layout' => false], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect ?: App::url('@system'), 'message' => $message];
}
示例3: loginAction
/**
* @Route(defaults={"_maintenance"=true})
* @Request({"redirect"})
*/
public function loginAction($redirect = '')
{
if (App::user()->isAuthenticated()) {
App::message()->info(__('You are already logged in.'));
return App::redirect();
}
return ['$view' => ['title' => __('Login'), 'name' => 'system/user/login.php'], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect];
}
示例4: loginAction
/**
* @Route(defaults={"_maintenance"=true})
* @Request({"redirect"})
*/
public function loginAction($redirect = '')
{
if (App::user()->isAuthenticated()) {
$module = App::module('system/user');
$url = App::url($module->config['login_redirect']);
return App::redirect($url);
}
return self::loginView(['last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect]);
return ['$view' => ['title' => __('Login'), 'name' => 'system/user/login.php'], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect];
}
示例5: loginAction
/**
* @Route(defaults={"_maintenance"=true})
* @Request({"redirect"})
*/
public function loginAction($redirect = '')
{
if (!$redirect) {
$redirect = App::url(App::config('system/user')['login_redirect']);
}
if (App::user()->isAuthenticated()) {
return App::redirect($redirect);
}
return ['$view' => ['title' => __('Login'), 'name' => 'system/user/login.php'], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect];
}
示例6: updateAction
/**
* @Request(csrf=true)
*/
public function updateAction()
{
if (!($file = App::session()->get('system.update'))) {
App::abort(400, __('You may not call this step directly.'));
}
App::session()->remove('system.update');
return App::response()->stream(function () use($file) {
try {
if (!file_exists($file) || !is_file($file)) {
throw new \RuntimeException('File does not exist.');
}
$updater = new SelfUpdater();
$updater->update($file);
} catch (\Exception $e) {
http_response_code(400);
echo $e->getMessage();
}
});
}
示例7: updateAction
/**
* @Request(csrf=true)
*/
public function updateAction()
{
if (!($file = App::session()->get('system.update'))) {
App::abort(400, __('You may not call this step directly.'));
}
App::session()->remove('system.update');
return App::response()->stream(function () use($file) {
$output = new StreamOutput(fopen('php://output', 'w'));
try {
if (!file_exists($file) || !is_file($file)) {
throw new \RuntimeException('File does not exist.');
}
$updater = new SelfUpdater($output);
$updater->update($file);
} catch (\Exception $e) {
$output->writeln(sprintf("\n<error>%s</error>", $e->getMessage()));
$output->write("status=error");
}
});
}
示例8: getSessionKey
protected function getSessionKey($file, $purchaseKey)
{
return sha1(App::system()->config('key') . '.' . App::session()->getId() . '.' . $file->id . '.' . $purchaseKey);
}
示例9: onFailure
public function onFailure(AuthenticateEvent $event)
{
$credentials = $event->getCredentials();
App::session()->set(Auth::LAST_USERNAME, $credentials['username']);
}