Remove componentes do scaffolding não utilizados. Todos os testes estão passando.usuarios_separados
| @ -1,27 +0,0 @@ | |||||
| <?php | |||||
| namespace App\Http\Livewire\Auth\Passwords; | |||||
| use Livewire\Component; | |||||
| class Confirm extends Component | |||||
| { | |||||
| /** @var string */ | |||||
| public $password = ''; | |||||
| public function confirm() | |||||
| { | |||||
| $this->validate([ | |||||
| 'password' => 'required|password', | |||||
| ]); | |||||
| session()->put('auth.password_confirmed_at', time()); | |||||
| redirect()->intended(route('home')); | |||||
| } | |||||
| public function render() | |||||
| { | |||||
| return view('livewire.auth.passwords.confirm'); | |||||
| } | |||||
| } | |||||
| @ -1,28 +0,0 @@ | |||||
| <?php | |||||
| namespace App\Http\Livewire\Auth; | |||||
| use App\Providers\RouteServiceProvider; | |||||
| use Illuminate\Support\Facades\Auth; | |||||
| use Livewire\Component; | |||||
| class Verify extends Component | |||||
| { | |||||
| public function resend() | |||||
| { | |||||
| if (Auth::user()->hasVerifiedEmail()) { | |||||
| redirect(route('home')); | |||||
| } | |||||
| Auth::user()->sendEmailVerificationNotification(); | |||||
| $this->emit('resent'); | |||||
| session()->flash('resent'); | |||||
| } | |||||
| public function render() | |||||
| { | |||||
| return view('livewire.auth.verify'); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,26 @@ | |||||
| <?php | |||||
| namespace App; | |||||
| use Illuminate\Database\Eloquent\Model; | |||||
| use Sushi\Sushi; | |||||
| class UserNature extends Model | |||||
| { | |||||
| use Sushi; | |||||
| protected $rows = [ | |||||
| [ | |||||
| 'key' => 'individual', | |||||
| 'name' => 'Pessoa Física', | |||||
| ], | |||||
| [ | |||||
| 'key' => 'informal', | |||||
| 'name' => 'Coletivo Informal', | |||||
| ], | |||||
| [ | |||||
| 'key' => 'company', | |||||
| 'name' => 'Pessoa Jurídica', | |||||
| ] | |||||
| ]; | |||||
| } | |||||
| @ -0,0 +1,30 @@ | |||||
| <?php | |||||
| namespace App; | |||||
| use Illuminate\Database\Eloquent\Model; | |||||
| use Sushi\Sushi; | |||||
| class UserType extends Model | |||||
| { | |||||
| use Sushi; | |||||
| protected $rows = [ | |||||
| [ | |||||
| 'key' => 'individual', | |||||
| 'name' => 'Indivíduo', | |||||
| ], | |||||
| [ | |||||
| 'key' => 'collective', | |||||
| 'name' => 'Coletivo Informal', | |||||
| ], | |||||
| [ | |||||
| 'key' => 'association', | |||||
| 'name' => 'Associação Formal', | |||||
| ], | |||||
| [ | |||||
| 'key' => 'company', | |||||
| 'name' => 'Empresa Privada', | |||||
| ], | |||||
| ]; | |||||
| } | |||||
| @ -1,8 +0,0 @@ | |||||
| @extends('layouts.auth') | |||||
| @section('title', 'Confirm your password') | |||||
| @section('content') | |||||
| <div> | |||||
| @livewire('auth.passwords.confirm') | |||||
| </div> | |||||
| @endsection | |||||
| @ -1,8 +0,0 @@ | |||||
| @extends('layouts.auth') | |||||
| @section('title', 'Verify your email address') | |||||
| @section('content') | |||||
| <div> | |||||
| @livewire('auth.verify') | |||||
| </div> | |||||
| @endsection | |||||
| @ -1,50 +0,0 @@ | |||||
| <div> | |||||
| <div class="sm:mx-auto sm:w-full sm:max-w-md"> | |||||
| <a href="{{ route('home') }}"> | |||||
| <x-logo class="w-auto h-16 mx-auto text-green-600" /> | |||||
| </a> | |||||
| <h2 class="mt-6 text-3xl font-extrabold text-center text-gray-900 leading-9"> | |||||
| Confirm your password | |||||
| </h2> | |||||
| <p class="mt-2 text-sm text-center text-gray-600 leading-5 max-w"> | |||||
| Please confirm your password before continuing | |||||
| </p> | |||||
| </div> | |||||
| <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md"> | |||||
| <div class="px-4 py-8 bg-white shadow sm:rounded-lg sm:px-10"> | |||||
| <form wire:submit.prevent="confirm"> | |||||
| <div> | |||||
| <label for="password" class="block text-sm font-medium text-gray-700 leading-5"> | |||||
| Password | |||||
| </label> | |||||
| <div class="mt-1 rounded-md shadow-sm"> | |||||
| <input wire:model.lazy="password" id="password" name="password" type="password" required autofocus class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md placeholder-gray-400 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:text-sm sm:leading-5 @error('password') border-red-300 text-red-900 placeholder-red-300 focus:border-red-300 focus:shadow-outline-red @enderror" /> | |||||
| </div> | |||||
| @error('password') | |||||
| <p class="mt-2 text-sm text-red-600" id="password-error">{{ $message }}</p> | |||||
| @enderror | |||||
| </div> | |||||
| <div class="flex items-center justify-end mt-6"> | |||||
| <div class="text-sm leading-5"> | |||||
| <a href="{{ route('password.request') }}" class="font-medium text-green-600 hover:text-green-500 focus:outline-none focus:underline transition ease-in-out duration-150"> | |||||
| Forgot your password? | |||||
| </a> | |||||
| </div> | |||||
| </div> | |||||
| <div class="mt-6"> | |||||
| <span class="block w-full rounded-md shadow-sm"> | |||||
| <button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white bg-green-600 border border-transparent rounded-md hover:bg-green-500 focus:outline-none focus:border-green-700 focus:shadow-outline-green active:bg-green-700 transition duration-150 ease-in-out"> | |||||
| Confirm password | |||||
| </button> | |||||
| </span> | |||||
| </div> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| @ -1,44 +0,0 @@ | |||||
| <div> | |||||
| <div class="sm:mx-auto sm:w-full sm:max-w-md"> | |||||
| <a href="{{ route('home') }}"> | |||||
| <x-logo class="w-auto h-16 mx-auto text-green-600" /> | |||||
| </a> | |||||
| <h2 class="mt-6 text-3xl font-extrabold text-center text-gray-900 leading-9"> | |||||
| Verify your email address | |||||
| </h2> | |||||
| <p class="mt-2 text-sm text-center text-gray-600 leading-5 max-w"> | |||||
| Or | |||||
| <a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" class="font-medium text-green-600 hover:text-green-500 focus:outline-none focus:underline transition ease-in-out duration-150"> | |||||
| sign out | |||||
| </a> | |||||
| <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;"> | |||||
| @csrf | |||||
| </form> | |||||
| </p> | |||||
| </div> | |||||
| <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md"> | |||||
| <div class="px-4 py-8 bg-white shadow sm:rounded-lg sm:px-10"> | |||||
| @if (session('resent')) | |||||
| <div class="flex items-center px-4 py-3 mb-6 text-sm text-white bg-green-500 rounded shadow" role="alert"> | |||||
| <svg class="w-4 h-4 mr-3 fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> | |||||
| <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path> | |||||
| </svg> | |||||
| <p>A fresh verification link has been sent to your email address.</p> | |||||
| </div> | |||||
| @endif | |||||
| <div class="text-sm text-gray-700"> | |||||
| <p>Before proceeding, please check your email for a verification link.</p> | |||||
| <p class="mt-3"> | |||||
| If you did not receive the email, <a wire:click="resend" class="text-green-700 cursor-pointer hover:text-green-600 focus:outline-none focus:underline transition ease-in-out duration-150">click here to request another</a>. | |||||
| </p> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| @ -1,76 +0,0 @@ | |||||
| <?php | |||||
| namespace Tests\Feature\Auth\Passwords; | |||||
| use App\User; | |||||
| use Illuminate\Foundation\Testing\RefreshDatabase; | |||||
| use Illuminate\Support\Facades\Hash; | |||||
| use Illuminate\Support\Facades\Route; | |||||
| use Livewire\Livewire; | |||||
| use Tests\TestCase; | |||||
| class ConfirmTest extends TestCase | |||||
| { | |||||
| use RefreshDatabase; | |||||
| protected function setUp(): void | |||||
| { | |||||
| parent::setUp(); | |||||
| Route::get('/must-be-confirmed', function () { | |||||
| return 'You must be confirmed to see this page.'; | |||||
| })->middleware(['web', 'password.confirm']); | |||||
| } | |||||
| /** @test */ | |||||
| public function a_user_must_confirm_their_password_before_visiting_a_protected_page() | |||||
| { | |||||
| $user = factory(User::class)->create(); | |||||
| $this->be($user); | |||||
| $this->get('/must-be-confirmed') | |||||
| ->assertRedirect(route('password.confirm')); | |||||
| $this->followingRedirects() | |||||
| ->get('/must-be-confirmed') | |||||
| ->assertSeeLivewire('auth.passwords.confirm'); | |||||
| } | |||||
| /** @test */ | |||||
| public function a_user_must_enter_a_password_to_confirm_it() | |||||
| { | |||||
| Livewire::test('auth.passwords.confirm') | |||||
| ->call('confirm') | |||||
| ->assertHasErrors(['password' => 'required']); | |||||
| } | |||||
| /** @test */ | |||||
| public function a_user_must_enter_their_own_password_to_confirm_it() | |||||
| { | |||||
| $user = factory(User::class)->create([ | |||||
| 'password' => Hash::make('password'), | |||||
| ]); | |||||
| Livewire::test('auth.passwords.confirm') | |||||
| ->set('password', 'not-password') | |||||
| ->call('confirm') | |||||
| ->assertHasErrors(['password' => 'password']); | |||||
| } | |||||
| /** @test */ | |||||
| public function a_user_who_confirms_their_password_will_get_redirected() | |||||
| { | |||||
| $user = factory(User::class)->create([ | |||||
| 'password' => Hash::make('password'), | |||||
| ]); | |||||
| $this->be($user); | |||||
| $this->withSession(['url.intended' => '/must-be-confirmed']); | |||||
| Livewire::test('auth.passwords.confirm') | |||||
| ->set('password', 'password') | |||||
| ->call('confirm') | |||||
| ->assertRedirect('/must-be-confirmed'); | |||||
| } | |||||
| } | |||||
| @ -1,65 +0,0 @@ | |||||
| <?php | |||||
| namespace Tests\Feature\Auth; | |||||
| use App\User; | |||||
| use Tests\TestCase; | |||||
| use Livewire\Livewire; | |||||
| use Illuminate\Support\Facades\Hash; | |||||
| use App\Providers\RouteServiceProvider; | |||||
| use Illuminate\Foundation\Testing\RefreshDatabase; | |||||
| use Illuminate\Support\Carbon; | |||||
| use Illuminate\Support\Facades\Auth; | |||||
| use Illuminate\Support\Facades\Config; | |||||
| use Illuminate\Support\Facades\URL; | |||||
| class VerifyTest extends TestCase | |||||
| { | |||||
| use RefreshDatabase; | |||||
| /** @test */ | |||||
| public function can_view_verification_page() | |||||
| { | |||||
| $user = factory(User::class)->create([ | |||||
| 'email_verified_at' => null, | |||||
| ]); | |||||
| Auth::login($user); | |||||
| $this->get(route('verification.notice')) | |||||
| ->assertSuccessful() | |||||
| ->assertSeeLivewire('auth.verify'); | |||||
| } | |||||
| /** @test */ | |||||
| public function can_resend_verification_email() | |||||
| { | |||||
| $user = factory(User::class)->create(); | |||||
| Livewire::actingAs($user); | |||||
| Livewire::test('auth.verify') | |||||
| ->call('resend') | |||||
| ->assertEmitted('resent'); | |||||
| } | |||||
| /** @test */ | |||||
| public function can_verify() | |||||
| { | |||||
| $user = factory(User::class)->create([ | |||||
| 'email_verified_at' => null, | |||||
| ]); | |||||
| Auth::login($user); | |||||
| $url = URL::temporarySignedRoute('verification.verify', Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)), [ | |||||
| 'id' => $user->getKey(), | |||||
| 'hash' => sha1($user->getEmailForVerification()), | |||||
| ]); | |||||
| $this->get($url) | |||||
| ->assertRedirect(route('home')); | |||||
| $this->assertTrue($user->hasVerifiedEmail()); | |||||
| } | |||||
| } | |||||
| @ -1,18 +0,0 @@ | |||||
| <?php | |||||
| namespace Tests\Feature; | |||||
| use Tests\TestCase; | |||||
| class ExampleTest extends TestCase | |||||
| { | |||||
| /** | |||||
| * A basic test example. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function testBasicTest() | |||||
| { | |||||
| $this->get(route('home'))->assertSuccessful(); | |||||
| } | |||||
| } | |||||