Fixed issue #177
This commit is contained in:
parent
d5b95f542b
commit
afefbfa99d
3 changed files with 19 additions and 70 deletions
|
@ -20,19 +20,19 @@ class RememberMiddleware extends Middleware
|
|||
if (!$this->session->get('logged', false) && !empty($request->getCookieParams()['remember'])) {
|
||||
[$selector, $token] = explode(':', $request->getCookieParams()['remember']);
|
||||
|
||||
$user = $this->database->query('SELECT `id`, `email`, `username`,`is_admin`, `active`, `remember_token`, `current_disk_quota`, `max_disk_quota` FROM `users` WHERE `remember_selector` = ? AND `remember_expire` > ? LIMIT 1',
|
||||
$user = $this->database->query('SELECT `id`, `username`,`is_admin`, `active`, `remember_token`, `current_disk_quota`, `max_disk_quota`, `copy_raw` FROM `users` WHERE `remember_selector` = ? AND `remember_expire` > ? LIMIT 1',
|
||||
[$selector, date('Y-m-d\TH:i:s', time())]
|
||||
)->fetch();
|
||||
|
||||
if ($user && password_verify($token, $user->remember_token) && $user->active) {
|
||||
$this->session->set('logged', true);
|
||||
$this->session->set('user_id', $user->id);
|
||||
$this->session->set('username', $user->username);
|
||||
$this->session->set('admin', $user->is_admin);
|
||||
$this->session->set('logged', true)
|
||||
->set('user_id', $user->id)
|
||||
->set('username', $user->username)
|
||||
->set('admin', $user->is_admin)
|
||||
->set('copy_raw', $user->copy_raw);
|
||||
$this->setSessionQuotaInfo($user->current_disk_quota, $user->max_disk_quota);
|
||||
$this->refreshRememberCookie($user->id);
|
||||
}
|
||||
|
||||
$this->refreshRememberCookie($user->id);
|
||||
}
|
||||
|
||||
return $handler->handle($request);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sergix44/xbackbone",
|
||||
"version": "3.1.RC1",
|
||||
"version": "3.1.RC2",
|
||||
"description": "A lightweight ShareX PHP backend",
|
||||
"type": "project",
|
||||
"require": {
|
||||
|
@ -21,8 +21,7 @@
|
|||
"slim/slim": "^4.0",
|
||||
"spatie/flysystem-dropbox": "^1.0",
|
||||
"superbalist/flysystem-google-storage": "^7.2",
|
||||
"twig/twig": "^2.12",
|
||||
"avto-dev/composer-cleanup-plugin": "^2.0"
|
||||
"twig/twig": "^2.12"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
|
|
70
composer.lock
generated
70
composer.lock
generated
|
@ -4,58 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1963bb9b1a8f5fad240b9f85112ac008",
|
||||
"content-hash": "979e04cb72a48a50d7872132f8efa29f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "avto-dev/composer-cleanup-plugin",
|
||||
"version": "v2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/avto-dev/composer-cleanup-plugin.git",
|
||||
"reference": "62d55ce097b7ea4336fa89b872ef21cacd5f82cd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/avto-dev/composer-cleanup-plugin/zipball/62d55ce097b7ea4336fa89b872ef21cacd5f82cd",
|
||||
"reference": "62d55ce097b7ea4336fa89b872ef21cacd5f82cd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0",
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^1.8.6",
|
||||
"phpstan/phpstan": "~0.12",
|
||||
"phpunit/phpunit": "~7.5",
|
||||
"symfony/var-dumper": "~3.2 || ^4.0"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "AvtoDev\\Composer\\Cleanup\\Plugin"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AvtoDev\\Composer\\Cleanup\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "avto-dev",
|
||||
"homepage": "https://github.com/avto-dev"
|
||||
},
|
||||
{
|
||||
"name": "Barry vd. Heuvel",
|
||||
"email": "barryvdh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A composer cleanup plugin, to remove tests and documentation to save space",
|
||||
"time": "2020-02-09T18:06:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.134.3",
|
||||
|
@ -1334,22 +1284,22 @@
|
|||
},
|
||||
{
|
||||
"name": "php-di/php-di",
|
||||
"version": "6.0.11",
|
||||
"version": "6.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-DI/PHP-DI.git",
|
||||
"reference": "9bdcc2f41f5fb700ddd01bc4fa8d5bd7b3f94620"
|
||||
"reference": "69238bd49acc0eb6a967029311eeadc3f7c5d538"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/9bdcc2f41f5fb700ddd01bc4fa8d5bd7b3f94620",
|
||||
"reference": "9bdcc2f41f5fb700ddd01bc4fa8d5bd7b3f94620",
|
||||
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/69238bd49acc0eb6a967029311eeadc3f7c5d538",
|
||||
"reference": "69238bd49acc0eb6a967029311eeadc3f7c5d538",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"jeremeamia/superclosure": "^2.0",
|
||||
"nikic/php-parser": "^2.0|^3.0|^4.0",
|
||||
"php": ">=7.0.0",
|
||||
"php": ">=7.2.0",
|
||||
"php-di/invoker": "^2.0",
|
||||
"php-di/phpdoc-reader": "^2.0.1",
|
||||
"psr/container": "^1.0"
|
||||
|
@ -1360,10 +1310,10 @@
|
|||
"require-dev": {
|
||||
"doctrine/annotations": "~1.2",
|
||||
"friendsofphp/php-cs-fixer": "^2.4",
|
||||
"mnapoli/phpunit-easymock": "~1.0",
|
||||
"mnapoli/phpunit-easymock": "^1.2",
|
||||
"ocramius/proxy-manager": "~2.0.2",
|
||||
"phpstan/phpstan": "^0.9.2",
|
||||
"phpunit/phpunit": "~6.4"
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/annotations": "Install it if you want to use annotations (version ~1.2)",
|
||||
|
@ -1393,7 +1343,7 @@
|
|||
"ioc",
|
||||
"psr11"
|
||||
],
|
||||
"time": "2019-12-12T07:58:02+00:00"
|
||||
"time": "2020-04-06T09:54:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-di/phpdoc-reader",
|
||||
|
|
Loading…
Reference in a new issue