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:
Daniel Meltzer 2018-04-16 19:38:32 -04:00
parent 61c912e2ac
commit afc8ac5e72
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0
6 changed files with 641 additions and 347 deletions

View file

@ -208,15 +208,20 @@ class LoginController extends Controller
}
$user = Auth::user();
$google2fa = app()->make('PragmaRX\Google2FA\Contracts\Google2FA');
$google2fa = app()->make('pragmarx.google2fa');
if ($user->two_factor_secret=='') {
$user->two_factor_secret = $google2fa->generateSecretKey(32);
$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($user->username),
$user->two_factor_secret
@ -251,7 +256,7 @@ class LoginController extends Controller
$user = Auth::user();
$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);
if ($valid) {

View file

@ -111,7 +111,8 @@ abstract class Importer
public function import()
{
$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/
// This 'inverts' the fields such that we have a collection of fields indexed by name.

View file

@ -6,28 +6,30 @@
"type": "project",
"require": {
"php": ">=7.1.3",
"bacon/bacon-qr-code": "^1.0",
"barryvdh/laravel-debugbar": "^3.1.4",
"codeception/codeception": "^2.4",
"doctrine/cache": "^1.6",
"doctrine/common": "^2.7",
"doctrine/dbal": "v2.5.13",
"doctrine/inflector": "1.1.*",
"doctrine/instantiator": "1.0.*",
"doctrine/dbal": "v2.7.1",
"doctrine/inflector": "1.3.0",
"doctrine/instantiator": "1.1.*",
"erusev/parsedown": "^1.6",
"fideloper/proxy": "~4.0",
"intervention/image": "^2.3",
"javiereguiluz/easyslugger": "^1.0",
"laravel/framework": "5.6.15",
"laravel/passport": "~5.0",
"laravel/framework": "5.6.16",
"laravel/passport": "~6.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.3",
"league/csv": "^8.1",
"league/csv": "^9.0",
"maknz/slack": "^1.7",
"neitanod/forceutf8": "^2.0",
"patchwork/utf8": "~1.2",
"phpdocumentor/reflection-docblock": "3.2.2",
"phpspec/prophecy": "1.6.2",
"pragmarx/google2fa": "^1.0",
"phpspec/prophecy": "1.7.5",
"pragmarx/google2fa": "^3.0",
"pragmarx/google2fa-laravel": "^0.2.0",
"predis/predis": "^1.1",
"rollbar/rollbar-laravel": "^2.3",
"schuppo/password-strength": "~1.5",
@ -41,8 +43,8 @@
"fzaninotto/faker": "~1.4",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "*",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
"symfony/css-selector": "4.0.*",
"symfony/dom-crawler": "4.0.*"
},
"extra": {
"laravel": {

943
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -257,7 +257,7 @@ return [
Collective\Html\HtmlServiceProvider::class,
Spatie\Backup\BackupServiceProvider::class,
Fideloper\Proxy\TrustedProxyServiceProvider::class,
PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider::class,
PragmaRX\Google2FALaravel\ServiceProvider::class,
Laravel\Passport\PassportServiceProvider::class,
Laravel\Tinker\TinkerServiceProvider::class,
Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class,
@ -331,7 +331,7 @@ return [
'Input' => Illuminate\Support\Facades\Input::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Google2FA' => PragmaRX\Google2FA\Vendor\Laravel\Facade::class,
'Google2FA' => PragmaRX\Google2FALaravel\Facade::class,
//'Debugbar' => Barryvdh\Debugbar\Facade::class,
'Image' => Intervention\Image\ImageManagerStatic::class,
'Carbon' => Carbon\Carbon::class,

View file

@ -25,16 +25,15 @@ class ApiCategoriesCest
$I->wantTo('Get a list of categories');
// call
$I->sendGET('/categories?order_by=id&limit=10');
$I->sendGET('/categories?sort=id&limit=10');
$I->seeResponseIsJson();
$I->seeResponseCodeIs(200);
$response = json_decode($I->grabResponse(), true);
// dd($response);
// sample verify
$category = App\Models\Category::withCount('assets','accessories','consumables','components','licenses')
->orderByDesc('created_at')->take(10)->get()->shuffle()->first();
$I->seeResponseContainsJson((new CategoriesTransformer)->transformCategory($category));
}