Skip to content

Commit

Permalink
Merge branch 'master' into feature/update-enrollments-status
Browse files Browse the repository at this point in the history
* master: (53 commits)
  Adiciona arquivo de bootstrap para testing
  Usa configurações do arquivo .env.testing
  Remove manipulação de sessão desnecessária
  Reorganização dos arquivos
  Suprimi erros da manipulação de sessão
  Adiciona diretório de tests no classmap dev
  Mantém o padrão do Laravel no arquivo phpunit.xml
  Remove arquivo bootstrap
  Altera config stopOnFailure do phpunit para false
  Ajusta paths para arquivos de configuração
  Remove session_start
  Remove os testes da estrutura antiga
  Ajustes no i-educar para rodar os testes
  Ajusta os testes para rodar na nova estrutura
  Copia os testes para a nova estrutura
  Remove o Telescope de produção
  Adiciona variável de ambiente para ativar Telescope
  Adiciona variável de ambiente para timezone
  Laravel Telescope
  Adiciona lib bcmath ao container PHP
  ...
  • Loading branch information
munizeverton committed Nov 22, 2018
2 parents 6147547 + 5a82b89 commit 1b78394
Show file tree
Hide file tree
Showing 213 changed files with 115,058 additions and 1,931 deletions.
13 changes: 11 additions & 2 deletions .env.example
Expand Up @@ -3,14 +3,23 @@ APP_ENV=development
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=America/Sao_Paulo
APP_TRACK_ERROR=false

API_URI=http://localhost/module/Api/Regra
API_ACCESS_KEY=
API_SECRET_KEY=

CORE_EXT_CONFIGURATION_ENV="${APP_ENV}"

LEGACY_CODE=true
LEGACY_DISPLAY_ERRORS=false
LEGACY_PATH=ieducar

LOG_CHANNEL=stack

TELESCOPE_ENABLED=true

DB_CONNECTION=pgsql
DB_HOST=postgres
DB_PORT=5432
Expand All @@ -20,9 +29,9 @@ DB_PASSWORD=ieducar

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=redis
REDIS_PASSWORD=null
Expand All @@ -43,4 +52,4 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

HONEYBADGER_API_KEY=
HONEYBADGER_API_KEY=
11 changes: 11 additions & 0 deletions .gitignore
Expand Up @@ -6,11 +6,22 @@
/vendor
.env
.env.host
.env.testing
.php_cs.cache
docker-compose.yml
phinx.php
phinx.yml

/node_modules
/public/hot
/public/storage
/storage/*.key
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.phpunit.result.cache

# IDE Files
## PHPStorm InteliJ
*.idea
Expand Down
6 changes: 3 additions & 3 deletions app/Exceptions/Handler.php
Expand Up @@ -30,7 +30,7 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
Expand All @@ -45,8 +45,8 @@ public function report(Exception $exception)
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Auth/RegisterController.php
Expand Up @@ -49,9 +49,9 @@ public function __construct()
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:6', 'confirmed'],
]);
}

Expand Down
41 changes: 41 additions & 0 deletions app/Http/Controllers/Auth/VerificationController.php
@@ -0,0 +1,41 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;

class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/

use VerifiesEmails;

/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
21 changes: 19 additions & 2 deletions app/Http/Kernel.php
Expand Up @@ -64,7 +64,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
Expand All @@ -73,6 +73,23 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'navigation' => Navigation::class,
'ieducar.authenticatesession' => LegacyAuthenticateSession::class
'ieducar.authenticatesession' => LegacyAuthenticateSession::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];

/**
* The priority-sorted list of middleware.
*
* This forces the listed middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
}
21 changes: 21 additions & 0 deletions app/Http/Middleware/Authenticate.php
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;

class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
7 changes: 7 additions & 0 deletions app/Http/Middleware/VerifyCsrfToken.php
Expand Up @@ -6,6 +6,13 @@

class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;

/**
* The URIs that should be excluded from CSRF verification.
*
Expand Down
2 changes: 2 additions & 0 deletions app/Providers/AppServiceProvider.php
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\Browser;
use Laravel\Dusk\DuskServiceProvider;
use Laravel\Telescope\TelescopeServiceProvider;

class AppServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -74,6 +75,7 @@ public function register()

if ($this->app->environment('development', 'dusk', 'local', 'testing')) {
$this->app->register(DuskServiceProvider::class);
$this->app->register(TelescopeServiceProvider::class);
}

$this->app->bind(\iEducar\Modules\ErrorTracking\Tracker::class, \iEducar\Modules\ErrorTracking\HoneyBadgerTracker::class);
Expand Down
6 changes: 4 additions & 2 deletions app/Providers/EventServiceProvider.php
Expand Up @@ -3,6 +3,8 @@
namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
Expand All @@ -13,8 +15,8 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
'App\Events\Event' => [
'App\Listeners\EventListener',
Registered::class => [
SendEmailVerificationNotification::class,
],
];

Expand Down
70 changes: 70 additions & 0 deletions app/Providers/TelescopeServiceProvider.php
@@ -0,0 +1,70 @@
<?php

namespace App\Providers;

use Laravel\Telescope\Telescope;
use Illuminate\Support\Facades\Gate;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\TelescopeApplicationServiceProvider;

class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// Telescope::night();

$this->hideSensitiveRequestDetails();

Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->isLocal()) {
return true;
}

return $entry->isReportableException() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
});
}

/**
* Prevent sensitive request details from being logged by Telescope.
*
* @return void
*/
protected function hideSensitiveRequestDetails()
{
if ($this->app->isLocal()) {
return;
}

Telescope::hideRequestParameters(['_token']);

Telescope::hideRequestHeaders([
'cookie',
'x-csrf-token',
'x-xsrf-token',
]);
}

/**
* Register the Telescope gate.
*
* This gate determines who can access Telescope in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewTelescope', function ($user) {
return in_array($user->email, [
//
]);
});
}
}
2 changes: 1 addition & 1 deletion bootstrap/app.php
Expand Up @@ -12,7 +12,7 @@
*/

$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
dirname(__DIR__)
);

/*
Expand Down
11 changes: 11 additions & 0 deletions bootstrap/testing.php
@@ -0,0 +1,11 @@
<?php

use Dotenv\Dotenv;

require_once __DIR__ . '/../vendor/autoload.php';

try {
(new Dotenv(__DIR__ . '/../', '.env.testing'))->load();
} catch (Throwable $throwable) {
//
}

0 comments on commit 1b78394

Please sign in to comment.