mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Php7 updates (#5365)
* Update composer dependencies. * Update google2fa to version 3 and make adjustments related to it. * Update to league/csv 9 * Fix api categories test. we were passing the wrong parameter to the url which caused the wrong data to be fetched.
This commit is contained in:
parent
61c912e2ac
commit
afc8ac5e72
|
@ -208,15 +208,20 @@ class LoginController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$google2fa = app()->make('PragmaRX\Google2FA\Contracts\Google2FA');
|
$google2fa = app()->make('pragmarx.google2fa');
|
||||||
|
|
||||||
if ($user->two_factor_secret=='') {
|
if ($user->two_factor_secret=='') {
|
||||||
$user->two_factor_secret = $google2fa->generateSecretKey(32);
|
$user->two_factor_secret = $google2fa->generateSecretKey(32);
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $google2fa_url = $google2fa->getQRCodeGoogleUrl(
|
||||||
|
// urlencode(Setting::getSettings()->site_name),
|
||||||
|
// urlencode($user->username),
|
||||||
|
// $user->two_factor_secret
|
||||||
|
// );
|
||||||
|
|
||||||
$google2fa_url = $google2fa->getQRCodeGoogleUrl(
|
$google2fa_url = $google2fa->getQRCodeInline(
|
||||||
urlencode(Setting::getSettings()->site_name),
|
urlencode(Setting::getSettings()->site_name),
|
||||||
urlencode($user->username),
|
urlencode($user->username),
|
||||||
$user->two_factor_secret
|
$user->two_factor_secret
|
||||||
|
@ -251,7 +256,7 @@ class LoginController extends Controller
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$secret = $request->get('two_factor_secret');
|
$secret = $request->get('two_factor_secret');
|
||||||
$google2fa = app()->make('PragmaRX\Google2FA\Contracts\Google2FA');
|
$google2fa = app()->make('pragmarx.google2fa');
|
||||||
$valid = $google2fa->verifyKey($user->two_factor_secret, $secret);
|
$valid = $google2fa->verifyKey($user->two_factor_secret, $secret);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
|
@ -111,7 +111,8 @@ abstract class Importer
|
||||||
public function import()
|
public function import()
|
||||||
{
|
{
|
||||||
$headerRow = $this->csv->fetchOne();
|
$headerRow = $this->csv->fetchOne();
|
||||||
$results = $this->normalizeInputArray($this->csv->fetchAssoc());
|
$this->csv->setHeaderOffset(0);
|
||||||
|
$results = $this->normalizeInputArray($this->csv->getRecords());
|
||||||
|
|
||||||
// Stolen From https://adamwathan.me/2016/07/14/customizing-keys-when-mapping-collections/
|
// Stolen From https://adamwathan.me/2016/07/14/customizing-keys-when-mapping-collections/
|
||||||
// This 'inverts' the fields such that we have a collection of fields indexed by name.
|
// This 'inverts' the fields such that we have a collection of fields indexed by name.
|
||||||
|
|
|
@ -6,28 +6,30 @@
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1.3",
|
"php": ">=7.1.3",
|
||||||
|
"bacon/bacon-qr-code": "^1.0",
|
||||||
"barryvdh/laravel-debugbar": "^3.1.4",
|
"barryvdh/laravel-debugbar": "^3.1.4",
|
||||||
"codeception/codeception": "^2.4",
|
"codeception/codeception": "^2.4",
|
||||||
"doctrine/cache": "^1.6",
|
"doctrine/cache": "^1.6",
|
||||||
"doctrine/common": "^2.7",
|
"doctrine/common": "^2.7",
|
||||||
"doctrine/dbal": "v2.5.13",
|
"doctrine/dbal": "v2.7.1",
|
||||||
"doctrine/inflector": "1.1.*",
|
"doctrine/inflector": "1.3.0",
|
||||||
"doctrine/instantiator": "1.0.*",
|
"doctrine/instantiator": "1.1.*",
|
||||||
"erusev/parsedown": "^1.6",
|
"erusev/parsedown": "^1.6",
|
||||||
"fideloper/proxy": "~4.0",
|
"fideloper/proxy": "~4.0",
|
||||||
"intervention/image": "^2.3",
|
"intervention/image": "^2.3",
|
||||||
"javiereguiluz/easyslugger": "^1.0",
|
"javiereguiluz/easyslugger": "^1.0",
|
||||||
"laravel/framework": "5.6.15",
|
"laravel/framework": "5.6.16",
|
||||||
"laravel/passport": "~5.0",
|
"laravel/passport": "~6.0",
|
||||||
"laravel/tinker": "^1.0",
|
"laravel/tinker": "^1.0",
|
||||||
"laravelcollective/html": "^5.3",
|
"laravelcollective/html": "^5.3",
|
||||||
"league/csv": "^8.1",
|
"league/csv": "^9.0",
|
||||||
"maknz/slack": "^1.7",
|
"maknz/slack": "^1.7",
|
||||||
"neitanod/forceutf8": "^2.0",
|
"neitanod/forceutf8": "^2.0",
|
||||||
"patchwork/utf8": "~1.2",
|
"patchwork/utf8": "~1.2",
|
||||||
"phpdocumentor/reflection-docblock": "3.2.2",
|
"phpdocumentor/reflection-docblock": "3.2.2",
|
||||||
"phpspec/prophecy": "1.6.2",
|
"phpspec/prophecy": "1.7.5",
|
||||||
"pragmarx/google2fa": "^1.0",
|
"pragmarx/google2fa": "^3.0",
|
||||||
|
"pragmarx/google2fa-laravel": "^0.2.0",
|
||||||
"predis/predis": "^1.1",
|
"predis/predis": "^1.1",
|
||||||
"rollbar/rollbar-laravel": "^2.3",
|
"rollbar/rollbar-laravel": "^2.3",
|
||||||
"schuppo/password-strength": "~1.5",
|
"schuppo/password-strength": "~1.5",
|
||||||
|
@ -41,8 +43,8 @@
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"squizlabs/php_codesniffer": "*",
|
"squizlabs/php_codesniffer": "*",
|
||||||
"symfony/css-selector": "3.1.*",
|
"symfony/css-selector": "4.0.*",
|
||||||
"symfony/dom-crawler": "3.1.*"
|
"symfony/dom-crawler": "4.0.*"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
|
|
943
composer.lock
generated
943
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -257,7 +257,7 @@ return [
|
||||||
Collective\Html\HtmlServiceProvider::class,
|
Collective\Html\HtmlServiceProvider::class,
|
||||||
Spatie\Backup\BackupServiceProvider::class,
|
Spatie\Backup\BackupServiceProvider::class,
|
||||||
Fideloper\Proxy\TrustedProxyServiceProvider::class,
|
Fideloper\Proxy\TrustedProxyServiceProvider::class,
|
||||||
PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider::class,
|
PragmaRX\Google2FALaravel\ServiceProvider::class,
|
||||||
Laravel\Passport\PassportServiceProvider::class,
|
Laravel\Passport\PassportServiceProvider::class,
|
||||||
Laravel\Tinker\TinkerServiceProvider::class,
|
Laravel\Tinker\TinkerServiceProvider::class,
|
||||||
Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class,
|
Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class,
|
||||||
|
@ -331,7 +331,7 @@ return [
|
||||||
'Input' => Illuminate\Support\Facades\Input::class,
|
'Input' => Illuminate\Support\Facades\Input::class,
|
||||||
'Form' => Collective\Html\FormFacade::class,
|
'Form' => Collective\Html\FormFacade::class,
|
||||||
'Html' => Collective\Html\HtmlFacade::class,
|
'Html' => Collective\Html\HtmlFacade::class,
|
||||||
'Google2FA' => PragmaRX\Google2FA\Vendor\Laravel\Facade::class,
|
'Google2FA' => PragmaRX\Google2FALaravel\Facade::class,
|
||||||
//'Debugbar' => Barryvdh\Debugbar\Facade::class,
|
//'Debugbar' => Barryvdh\Debugbar\Facade::class,
|
||||||
'Image' => Intervention\Image\ImageManagerStatic::class,
|
'Image' => Intervention\Image\ImageManagerStatic::class,
|
||||||
'Carbon' => Carbon\Carbon::class,
|
'Carbon' => Carbon\Carbon::class,
|
||||||
|
|
|
@ -25,16 +25,15 @@ class ApiCategoriesCest
|
||||||
$I->wantTo('Get a list of categories');
|
$I->wantTo('Get a list of categories');
|
||||||
|
|
||||||
// call
|
// call
|
||||||
$I->sendGET('/categories?order_by=id&limit=10');
|
$I->sendGET('/categories?sort=id&limit=10');
|
||||||
$I->seeResponseIsJson();
|
$I->seeResponseIsJson();
|
||||||
$I->seeResponseCodeIs(200);
|
$I->seeResponseCodeIs(200);
|
||||||
|
|
||||||
$response = json_decode($I->grabResponse(), true);
|
$response = json_decode($I->grabResponse(), true);
|
||||||
// dd($response);
|
|
||||||
// sample verify
|
// sample verify
|
||||||
|
|
||||||
$category = App\Models\Category::withCount('assets','accessories','consumables','components','licenses')
|
$category = App\Models\Category::withCount('assets','accessories','consumables','components','licenses')
|
||||||
->orderByDesc('created_at')->take(10)->get()->shuffle()->first();
|
->orderByDesc('created_at')->take(10)->get()->shuffle()->first();
|
||||||
|
|
||||||
$I->seeResponseContainsJson((new CategoriesTransformer)->transformCategory($category));
|
$I->seeResponseContainsJson((new CategoriesTransformer)->transformCategory($category));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue