diff --git a/app/Http/Controllers/Auth/EmailVerificationController.php b/app/Http/Controllers/Associates/Auth/EmailVerificationController.php similarity index 95% rename from app/Http/Controllers/Auth/EmailVerificationController.php rename to app/Http/Controllers/Associates/Auth/EmailVerificationController.php index cbb928c..ae0cd41 100644 --- a/app/Http/Controllers/Auth/EmailVerificationController.php +++ b/app/Http/Controllers/Associates/Auth/EmailVerificationController.php @@ -1,6 +1,6 @@ $token, ]); } diff --git a/app/Http/Controllers/Collaborators/Auth/EmailVerificationController.php b/app/Http/Controllers/Collaborators/Auth/EmailVerificationController.php new file mode 100644 index 0000000..a2f7ee2 --- /dev/null +++ b/app/Http/Controllers/Collaborators/Auth/EmailVerificationController.php @@ -0,0 +1,34 @@ +getKey())) { + throw new AuthorizationException(); + } + + if (!hash_equals((string) $hash, sha1(Auth::user()->getEmailForVerification()))) { + throw new AuthorizationException(); + } + + if (Auth::user()->hasVerifiedEmail()) { + return redirect(route('home')); + } + + if (Auth::user()->markEmailAsVerified()) { + event(new Verified(Auth::user())); + } + + return redirect(route('home')); + } +} diff --git a/app/Http/Controllers/Collaborators/Auth/LogoutController.php b/app/Http/Controllers/Collaborators/Auth/LogoutController.php new file mode 100644 index 0000000..98c8fd2 --- /dev/null +++ b/app/Http/Controllers/Collaborators/Auth/LogoutController.php @@ -0,0 +1,18 @@ + $token, + ]); + } +} diff --git a/app/Http/Livewire/Auth/Login.php b/app/Http/Livewire/Associates/Auth/Login.php similarity index 87% rename from app/Http/Livewire/Auth/Login.php rename to app/Http/Livewire/Associates/Auth/Login.php index ae6e7f4..714d2b4 100644 --- a/app/Http/Livewire/Auth/Login.php +++ b/app/Http/Livewire/Associates/Auth/Login.php @@ -1,6 +1,6 @@ validate([ + 'email' => ['required', 'email'], + 'password' => ['required'], + ]); + + if (!Auth::attempt($credentials, $this->remember)) { + $this->addError('email', trans('auth.failed')); + + return; + } + + redirect(route('home')); + } + + public function render() + { + return view('livewire.collaborators.auth.login'); + } +} diff --git a/app/Http/Livewire/Collaborators/Auth/Passwords/Email.php b/app/Http/Livewire/Collaborators/Auth/Passwords/Email.php new file mode 100644 index 0000000..519a6e3 --- /dev/null +++ b/app/Http/Livewire/Collaborators/Auth/Passwords/Email.php @@ -0,0 +1,47 @@ +validate([ + 'email' => ['required', 'email'], + ]); + + $response = $this->broker()->sendResetLink(['email' => $this->email]); + + if ($response == Password::RESET_LINK_SENT) { + $this->emailSentMessage = trans($response); + + return; + } + + $this->addError('email', trans($response)); + } + + /** + * Get the broker to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker() + { + return Password::broker(); + } + + public function render() + { + return view('livewire.collaborators.auth.passwords.email'); + } +} diff --git a/app/Http/Livewire/Collaborators/Auth/Passwords/Reset.php b/app/Http/Livewire/Collaborators/Auth/Passwords/Reset.php new file mode 100644 index 0000000..5a3e632 --- /dev/null +++ b/app/Http/Livewire/Collaborators/Auth/Passwords/Reset.php @@ -0,0 +1,92 @@ +token = $token; + } + + public function resetPassword() + { + $this->validate([ + 'token' => 'required', + 'email' => 'required|email', + 'password' => 'required|min:8|same:passwordConfirmation', + ]); + + $response = $this->broker()->reset( + [ + 'token' => $this->token, + 'email' => $this->email, + 'password' => $this->password + ], + function ($user, $password) { + $user->password = Hash::make($password); + + $user->setRememberToken(Str::random(60)); + + $user->save(); + + event(new PasswordReset($user)); + + $this->guard()->login($user); + } + ); + + if ($response == Password::PASSWORD_RESET) { + session()->flash(trans($response)); + + return redirect(route('home')); + } + + $this->addError('email', trans($response)); + } + + /** + * Get the broker to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker() + { + return Password::broker(); + } + + /** + * Get the guard to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } + + public function render() + { + return view('livewire.collaborators.auth.passwords.reset'); + } +} diff --git a/app/Http/Livewire/Collaborators/Auth/Register/Individual.php b/app/Http/Livewire/Collaborators/Auth/Register/Individual.php new file mode 100644 index 0000000..6e5a60e --- /dev/null +++ b/app/Http/Livewire/Collaborators/Auth/Register/Individual.php @@ -0,0 +1,181 @@ + 'cpf', + 'number' => '', + ]; + + /** @var array */ + public $address = [ + 'city' => '', + 'complement' => '', + 'country' => 'BR', + 'neighbourhood' => '', + 'number' => '', + 'postcode' => '', + 'state' => '', + 'street' => '', + ]; + + /** @var array */ + public $profile = [ + 'gender' => '', + 'occupation' => '', + 'scholarity' => '', + 'phone' => '', + 'secondary_emails' => '', + 'website' => '', + 'social' => '', + 'expectation' => '', + 'bike_use' => '', + 'org_participation' => '', + 'bike_activities' => '', + 'comments' => '', + 'ucb_comments' => '', + ]; + + /** @var string */ + public $email = ''; + + /** @var string */ + public $discussion = ''; + + /** @var int */ + public $contribution = null; + + public function updated($field) + { + $this->validateOnly($field, [ + 'address.city' => ['string'], + 'address.complement' => ['string'], + 'address.country' => ['string'], + 'address.neighbourhood' => ['string'], + 'address.number' => ['string'], + 'address.postcode' => ['string'], + 'address.state' => ['string'], + 'address.street' => ['string'], + 'birthday' => ['date_format:d/m/Y'], + 'contribution' => ['numeric'], + 'discussion' => ['string', 'in:all,daily,occasional'], + 'document.number' => ['string'], + 'document.type' => ['string', 'in:cpf,identity,passport'], + 'email' => ['email', 'unique:associates'], + 'profile.bike_activities' => ['string'], + 'profile.bike_use' => ['string'], + 'profile.comments' => ['string'], + 'profile.expectation' => ['string'], + 'profile.gender' => ['string', 'in:male,female,other'], + 'profile.occupation' => ['string'], + 'profile.org_participation' => ['string'], + 'profile.phone' => ['string'], + 'profile.scholarity' => ['string', 'in:primary-school,high-school,bachelor,master,phd'], + 'profile.secondary_emails' => ['string'], + 'profile.social' => ['string'], + 'profile.ucb_comments' => ['string'], + 'profile.website' => ['string'], + ]); + + if ($this->address['country'] === 'BR' && $field === 'address.postcode') { + $postcode = Str::slug($this->address['postcode'], ''); + + try { + $response = Http::timeout(5)->get("https://viacep.com.br/ws/$postcode/json"); + + if ($response->ok()) { + $address = $response->json(); + + $this->address['city'] = $response['localidade']; + $this->address['neighbourhood'] = $response['bairro']; + $this->address['state'] = $response['uf']; + $this->address['street'] = $response['logradouro']; + + $this->dispatchBrowserEvent('address-autofilled'); + } + } catch (\Illuminate\Http\Client\ConnectionException $exception) { + // TODO: show error to associate + } + } + } + + public function register() + { + $this->validate([ + 'address.city' => ['required', 'string'], + 'address.complement' => ['nullable', 'string'], + 'address.country' => ['required', 'string'], + 'address.neighbourhood' => ['required', 'string'], + 'address.number' => ['required', 'string'], + 'address.postcode' => ['required', 'string'], + 'address.state' => ['required', 'string'], + 'address.street' => ['required', 'string'], + 'birthday' => ['required', 'date_format:d/m/Y'], + 'contribution' => ['required', 'numeric'], + 'discussion' => ['required', 'string', 'in:all,daily,occasional'], + 'document.number' => ['required', 'string'], + 'document.type' => ['required', 'string', 'in:cpf,identity,passport'], + 'email' => ['required', 'email', 'unique:associates'], + 'name' => ['required'], + 'profile.bike_activities' => ['nullable', 'string'], + 'profile.bike_use' => ['nullable', 'string'], + 'profile.comments' => ['nullable', 'string'], + 'profile.expectation' => ['nullable', 'string'], + 'profile.gender' => ['required', 'string', 'in:male,female,other'], + 'profile.occupation' => ['required', 'string'], + 'profile.org_participation' => ['nullable', 'string'], + 'profile.phone' => ['required', 'string'], + 'profile.scholarity' => ['required', 'string', 'in:primary-school,high-school,bachelor,master,phd'], + 'profile.secondary_emails' => ['nullable', 'string'], + 'profile.social' => ['nullable', 'string'], + 'profile.ucb_comments' => ['nullable', 'string'], + 'profile.website' => ['nullable', 'string'], + ]); + + $associate = new Associate([ + 'address' => $this->address, + 'birthday' => Carbon::createFromFormat('d/m/Y', $this->birthday), + 'contribution' => $this->contribution, + 'discussion' => $this->discussion, + 'document' => $this->document, + 'email' => $this->email, + 'name' => $this->name, + 'profile' => $this->profile, + ]); + + $associate->associate_category_id = AssociateCategory::where('key', 'individual')->first()->id; + $associate->associate_nature_id = AssociateNature::where('key', 'individual')->first()->id; + $associate->associate_type_id = AssociateType::where('key', 'individual')->first()->id; + + $associate->save(); + + Auth::login($associate, true); + + redirect(route('home')); + } + + public function render() + { + return view('livewire.collaborators.auth.register.individual'); + } +} diff --git a/resources/views/auth/login.blade.php b/resources/views/associates/auth/login.blade.php similarity index 74% rename from resources/views/auth/login.blade.php rename to resources/views/associates/auth/login.blade.php index eac7864..7b805a4 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/associates/auth/login.blade.php @@ -3,6 +3,6 @@ @section('content')
- @livewire('auth.login') + @livewire('associates.auth.login')
@endsection diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/associates/auth/passwords/email.blade.php similarity index 68% rename from resources/views/auth/passwords/email.blade.php rename to resources/views/associates/auth/passwords/email.blade.php index 0155273..e2e90b9 100644 --- a/resources/views/auth/passwords/email.blade.php +++ b/resources/views/associates/auth/passwords/email.blade.php @@ -3,6 +3,6 @@ @section('content')
- @livewire('auth.passwords.email') + @livewire('associates.auth.passwords.email')
@endsection diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/associates/auth/passwords/reset.blade.php similarity index 73% rename from resources/views/auth/passwords/reset.blade.php rename to resources/views/associates/auth/passwords/reset.blade.php index 7b9ab06..19c0978 100644 --- a/resources/views/auth/passwords/reset.blade.php +++ b/resources/views/associates/auth/passwords/reset.blade.php @@ -3,7 +3,7 @@ @section('content')
- @livewire('auth.passwords.reset', [ + @livewire('associates.auth.passwords.reset', [ 'token' => $token ])
diff --git a/resources/views/auth/register/individual.blade.php b/resources/views/associates/auth/register/individual.blade.php similarity index 69% rename from resources/views/auth/register/individual.blade.php rename to resources/views/associates/auth/register/individual.blade.php index ef56704..e70a6f3 100644 --- a/resources/views/auth/register/individual.blade.php +++ b/resources/views/associates/auth/register/individual.blade.php @@ -3,6 +3,6 @@ @section('content')
- @livewire('auth.register.individual') + @livewire('associates.auth.register.individual')
@endsection diff --git a/resources/views/collaborators/auth/login.blade.php b/resources/views/collaborators/auth/login.blade.php new file mode 100644 index 0000000..8ac5205 --- /dev/null +++ b/resources/views/collaborators/auth/login.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.auth') +@section('title', 'Sign in to your account') + +@section('content') +
+ @livewire('collaborators.auth.login') +
+@endsection diff --git a/resources/views/collaborators/auth/passwords/email.blade.php b/resources/views/collaborators/auth/passwords/email.blade.php new file mode 100644 index 0000000..3708a81 --- /dev/null +++ b/resources/views/collaborators/auth/passwords/email.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.auth') +@section('title', 'Reset password') + +@section('content') +
+ @livewire('collaborators.auth.passwords.email') +
+@endsection diff --git a/resources/views/collaborators/auth/passwords/reset.blade.php b/resources/views/collaborators/auth/passwords/reset.blade.php new file mode 100644 index 0000000..f35a60a --- /dev/null +++ b/resources/views/collaborators/auth/passwords/reset.blade.php @@ -0,0 +1,10 @@ +@extends('layouts.auth') +@section('title', 'Reset password') + +@section('content') +
+ @livewire('collaborators.auth.passwords.reset', [ + 'token' => $token + ]) +
+@endsection diff --git a/resources/views/collaborators/auth/register/individual.blade.php b/resources/views/collaborators/auth/register/individual.blade.php new file mode 100644 index 0000000..bbda5be --- /dev/null +++ b/resources/views/collaborators/auth/register/individual.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.auth') +@section('title', __('user_categories.individual')) + +@section('content') +
+ @livewire('collaborators.auth.register.individual') +
+@endsection diff --git a/resources/views/livewire/auth/login.blade.php b/resources/views/livewire/associates/auth/login.blade.php similarity index 100% rename from resources/views/livewire/auth/login.blade.php rename to resources/views/livewire/associates/auth/login.blade.php diff --git a/resources/views/livewire/auth/passwords/email.blade.php b/resources/views/livewire/associates/auth/passwords/email.blade.php similarity index 100% rename from resources/views/livewire/auth/passwords/email.blade.php rename to resources/views/livewire/associates/auth/passwords/email.blade.php diff --git a/resources/views/livewire/auth/passwords/reset.blade.php b/resources/views/livewire/associates/auth/passwords/reset.blade.php similarity index 100% rename from resources/views/livewire/auth/passwords/reset.blade.php rename to resources/views/livewire/associates/auth/passwords/reset.blade.php diff --git a/resources/views/livewire/auth/register/individual.blade.php b/resources/views/livewire/associates/auth/register/individual.blade.php similarity index 100% rename from resources/views/livewire/auth/register/individual.blade.php rename to resources/views/livewire/associates/auth/register/individual.blade.php diff --git a/resources/views/livewire/collaborators/auth/login.blade.php b/resources/views/livewire/collaborators/auth/login.blade.php new file mode 100644 index 0000000..f6e91f4 --- /dev/null +++ b/resources/views/livewire/collaborators/auth/login.blade.php @@ -0,0 +1,74 @@ +
+
+ + + + +

+ {{ __('auth.login') }} +

+

+ Ou + + {{ __('auth.register') }} + +

+
+ +
+
+
+
+ + +
+ +
+ + @error('email') +

{{ $message }}

+ @enderror +
+ +
+ + +
+ +
+ + @error('password') +

{{ $message }}

+ @enderror +
+ +
+
+ + +
+ + +
+ +
+ + + +
+
+
+
+
diff --git a/resources/views/livewire/collaborators/auth/passwords/email.blade.php b/resources/views/livewire/collaborators/auth/passwords/email.blade.php new file mode 100644 index 0000000..32a5227 --- /dev/null +++ b/resources/views/livewire/collaborators/auth/passwords/email.blade.php @@ -0,0 +1,57 @@ +
+
+ + + + +

+ Reset password +

+
+ +
+
+ @if ($emailSentMessage) +
+
+
+ + + +
+ +
+

+ {{ $emailSentMessage }} +

+
+
+
+ @else +
+
+ + +
+ +
+ + @error('email') +

{{ $message }}

+ @enderror +
+ +
+ + + +
+
+ @endif +
+
+
diff --git a/resources/views/livewire/collaborators/auth/passwords/reset.blade.php b/resources/views/livewire/collaborators/auth/passwords/reset.blade.php new file mode 100644 index 0000000..7f3333a --- /dev/null +++ b/resources/views/livewire/collaborators/auth/passwords/reset.blade.php @@ -0,0 +1,65 @@ +
+
+ + + + +

+ Reset password +

+
+ +
+
+
+ + +
+ + +
+ +
+ + @error('email') +

{{ $message }}

+ @enderror +
+ +
+ + +
+ +
+ + @error('password') +

{{ $message }}

+ @enderror +
+ +
+ + +
+ +
+
+ +
+ + + +
+
+
+
+
diff --git a/resources/views/livewire/collaborators/auth/register/individual.blade.php b/resources/views/livewire/collaborators/auth/register/individual.blade.php new file mode 100644 index 0000000..d0a00bf --- /dev/null +++ b/resources/views/livewire/collaborators/auth/register/individual.blade.php @@ -0,0 +1,302 @@ +
+
+ + + + +

+ {{ __('user_categories.individual') }} +

+ +

+ Ou + + {{ __('auth.login') }} + +

+
+ +
+ +
+ +
+ +

+ Informações pessoais +

+ +

+ Conte-nos um pouco sobre você. +

+ +
+ +
+
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +

+ Dados de contato +

+ +

+ Endereço e meios de comunicação digitais. +

+ +
+ +
+
+ +
+ + + + @foreach (\App\Country::all() as $country) + + @endforeach + + + + @if ($address['country'] === 'BR') + + + + @else + + + + @endif + +
+ + + + + +
+ + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +

+ Dados de contato +

+ +

+ Endereço e meios de comunicação digitais. +

+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Outro + + + + + + + +
+
+ +
+ +
+ +
+ +

+ Declaração de consentimento +

+ +
+ +
+ +

+ Declaro que: +

+ +
    +
  1. Apoio e concordo com as Finalidades, Princípios, Objetivos e demais termos do Estatuto da UCB (http://www.uniaodeciclistas.org.br/sobre-a-ucb/estatuto/);
  2. +
  3. Confirmarei e/ou atualizará estes dados cadastrais uma vez por ano;
  4. +
  5. Caso solicitado, prestarei informações adicionais e/ou enviará documentos para a Diretoria da UCB.
  6. +
+ +
+ +
+ +
+ + + +
+ +
+ +
diff --git a/routes/web.php b/routes/web.php index 696db3b..9512364 100644 --- a/routes/web.php +++ b/routes/web.php @@ -15,15 +15,29 @@ use Illuminate\Support\Facades\Route; Route::middleware('guest')->group(function () { - Route::view('login', 'auth.login')->name('login'); + Route::view('login', 'associates.auth.login')->name('login'); Route::redirect('register', 'register/individual')->name('register'); - Route::view('register/individual', 'auth.register.individual')->name('register.individual'); + Route::view('register/individual', 'associates.auth.register.individual')->name('register.individual'); }); -Route::view('password/reset', 'auth.passwords.email')->name('password.request'); -Route::get('password/reset/{token}', 'Auth\PasswordResetController')->name('password.reset'); +Route::view('password/reset', 'associates.auth.passwords.email')->name('password.request'); +Route::get('password/reset/{token}', 'Associates\Auth\PasswordResetController')->name('password.reset'); Route::middleware('auth')->group(function () { Route::view('/', 'welcome')->name('home'); - Route::post('logout', 'Auth\LogoutController')->name('logout'); + Route::post('logout', 'Associates\Auth\LogoutController')->name('logout'); +}); + +Route::prefix('admin')->name('collaborators.')->group(function () { + Route::middleware('guest')->group(function () { + Route::view('login', 'collaborators.auth.login')->name('login'); + }); + + Route::view('password/reset', 'collaborators.auth.passwords.email')->name('password.request'); + Route::get('password/reset/{token}', 'Collaborators\Auth\PasswordResetController')->name('password.reset'); + + Route::middleware('auth:collaborators')->group(function () { + Route::view('/', 'welcome')->name('home'); + Route::post('logout', 'Collaborators\Auth\LogoutController')->name('logout'); + }); }); diff --git a/tests/Feature/Auth/LoginTest.php b/tests/Feature/Associates/Auth/LoginTest.php similarity index 87% rename from tests/Feature/Auth/LoginTest.php rename to tests/Feature/Associates/Auth/LoginTest.php index 2ca3313..2367636 100644 --- a/tests/Feature/Auth/LoginTest.php +++ b/tests/Feature/Associates/Auth/LoginTest.php @@ -1,6 +1,6 @@ get(route('login')) ->assertSuccessful() - ->assertSeeLivewire('auth.login'); + ->assertSeeLivewire('associates.auth.login'); } /** @test */ @@ -37,7 +37,7 @@ class LoginTest extends TestCase { $associate = $this->factoryWithoutObservers(Associate::class)->create(['password' => Hash::make('password')]); - Livewire::test('auth.login') + Livewire::test('associates.auth.login') ->set('email', $associate->email) ->set('password', 'password') ->call('authenticate'); @@ -50,7 +50,7 @@ class LoginTest extends TestCase { $associate = $this->factoryWithoutObservers(Associate::class)->create(['password' => Hash::make('password')]); - Livewire::test('auth.login') + Livewire::test('associates.auth.login') ->set('email', $associate->email) ->set('password', 'password') ->call('authenticate') @@ -62,7 +62,7 @@ class LoginTest extends TestCase { $associate = factory(Associate::class)->create(['password' => Hash::make('password')]); - Livewire::test('auth.login') + Livewire::test('associates.auth.login') ->set('password', 'password') ->call('authenticate') ->assertHasErrors(['email' => 'required']); @@ -73,7 +73,7 @@ class LoginTest extends TestCase { $associate = factory(Associate::class)->create(['password' => Hash::make('password')]); - Livewire::test('auth.login') + Livewire::test('associates.auth.login') ->set('email', 'invalid-email') ->set('password', 'password') ->call('authenticate') @@ -85,7 +85,7 @@ class LoginTest extends TestCase { $associate = factory(Associate::class)->create(['password' => Hash::make('password')]); - Livewire::test('auth.login') + Livewire::test('associates.auth.login') ->set('email', $associate->email) ->call('authenticate') ->assertHasErrors(['password' => 'required']); @@ -96,7 +96,7 @@ class LoginTest extends TestCase { $associate = factory(Associate::class)->create(); - Livewire::test('auth.login') + Livewire::test('associates.auth.login') ->set('email', $associate->email) ->set('password', 'bad-password') ->call('authenticate') diff --git a/tests/Feature/Auth/LogoutTest.php b/tests/Feature/Associates/Auth/LogoutTest.php similarity index 94% rename from tests/Feature/Auth/LogoutTest.php rename to tests/Feature/Associates/Auth/LogoutTest.php index 8fa5d71..40461ec 100644 --- a/tests/Feature/Auth/LogoutTest.php +++ b/tests/Feature/Associates/Auth/LogoutTest.php @@ -1,6 +1,6 @@ get(route('password.request')) ->assertSuccessful() - ->assertSeeLivewire('auth.passwords.email'); + ->assertSeeLivewire('associates.auth.passwords.email'); } /** @test */ public function a_associate_must_enter_an_email_address() { - Livewire::test('auth.passwords.email') + Livewire::test('associates.auth.passwords.email') ->call('sendResetPasswordLink') ->assertHasErrors(['email' => 'required']); } @@ -30,7 +30,7 @@ class EmailTest extends TestCase /** @test */ public function a_associate_must_enter_a_valid_email_address() { - Livewire::test('auth.passwords.email') + Livewire::test('associates.auth.passwords.email') ->set('email', 'email') ->call('sendResetPasswordLink') ->assertHasErrors(['email' => 'email']); @@ -41,7 +41,7 @@ class EmailTest extends TestCase { $associate = factory(Associate::class)->create(); - Livewire::test('auth.passwords.email') + Livewire::test('associates.auth.passwords.email') ->set('email', $associate->email) ->call('sendResetPasswordLink') ->assertNotSet('emailSentMessage', false); diff --git a/tests/Feature/Auth/Passwords/ResetTest.php b/tests/Feature/Associates/Auth/Passwords/ResetTest.php similarity index 85% rename from tests/Feature/Auth/Passwords/ResetTest.php rename to tests/Feature/Associates/Auth/Passwords/ResetTest.php index 0fe7f2e..6cb9651 100644 --- a/tests/Feature/Auth/Passwords/ResetTest.php +++ b/tests/Feature/Associates/Auth/Passwords/ResetTest.php @@ -1,6 +1,6 @@ $token, ])) ->assertSuccessful() - ->assertSeeLivewire('auth.passwords.reset'); + ->assertSeeLivewire('associates.auth.passwords.reset'); } /** @test */ @@ -50,7 +50,7 @@ class ResetTest extends TestCase 'created_at' => Carbon::now(), ]); - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => $token, ]) ->set('email', $associate->email) @@ -67,7 +67,7 @@ class ResetTest extends TestCase /** @test */ public function token_is_required() { - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => null, ]) ->call('resetPassword') @@ -77,7 +77,7 @@ class ResetTest extends TestCase /** @test */ public function email_is_required() { - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => Str::random(16), ]) ->set('email', null) @@ -88,7 +88,7 @@ class ResetTest extends TestCase /** @test */ public function email_is_valid_email() { - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => Str::random(16), ]) ->set('email', 'email') @@ -99,7 +99,7 @@ class ResetTest extends TestCase /** @test */ function password_is_required() { - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => Str::random(16), ]) ->set('password', '') @@ -110,7 +110,7 @@ class ResetTest extends TestCase /** @test */ function password_is_minimum_of_eight_characters() { - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => Str::random(16), ]) ->set('password', 'secret') @@ -121,7 +121,7 @@ class ResetTest extends TestCase /** @test */ function password_matches_password_confirmation() { - Livewire::test('auth.passwords.reset', [ + Livewire::test('associates.auth.passwords.reset', [ 'token' => Str::random(16), ]) ->set('password', 'new-password') diff --git a/tests/Feature/Auth/Register/IndividualTest.php b/tests/Feature/Associates/Auth/Register/IndividualTest.php similarity index 81% rename from tests/Feature/Auth/Register/IndividualTest.php rename to tests/Feature/Associates/Auth/Register/IndividualTest.php index b0509ab..6b8b117 100644 --- a/tests/Feature/Auth/Register/IndividualTest.php +++ b/tests/Feature/Associates/Auth/Register/IndividualTest.php @@ -1,6 +1,6 @@ get(route('register.individual')) ->assertSuccessful() - ->assertSeeLivewire('auth.register.individual'); + ->assertSeeLivewire('associates.auth.register.individual'); } /** @test */ @@ -42,7 +42,7 @@ class IndividualTest extends TestCase $associate = factory(Associate::class)->make(); - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.city', $associate->address['city']) ->set('address.complement', $associate->address['complement']) ->set('address.country', $associate->address['country']) @@ -80,7 +80,7 @@ class IndividualTest extends TestCase /** @test */ function address_city_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.city', '') ->call('register') ->assertHasErrors(['address.city' => 'required']); @@ -89,7 +89,7 @@ class IndividualTest extends TestCase /** @test */ function address_complement_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.complement', '') ->call('register') ->assertHasNoErrors('address.complement'); @@ -98,7 +98,7 @@ class IndividualTest extends TestCase /** @test */ function address_country_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.country', '') ->call('register') ->assertHasErrors(['address.country' => 'required']); @@ -107,7 +107,7 @@ class IndividualTest extends TestCase /** @test */ function address_neighbourhood_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.neighbourhood', '') ->call('register') ->assertHasErrors(['address.neighbourhood' => 'required']); @@ -116,7 +116,7 @@ class IndividualTest extends TestCase /** @test */ function address_postcode_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.postcode', '') ->call('register') ->assertHasErrors(['address.postcode' => 'required']); @@ -125,7 +125,7 @@ class IndividualTest extends TestCase /** @test */ function address_state_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.state', '') ->call('register') ->assertHasErrors(['address.state' => 'required']); @@ -134,7 +134,7 @@ class IndividualTest extends TestCase /** @test */ function address_street_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.street', '') ->call('register') ->assertHasErrors(['address.street' => 'required']); @@ -143,7 +143,7 @@ class IndividualTest extends TestCase /** @test */ function address_number_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('address.number', '') ->call('register') ->assertHasErrors(['address.number' => 'required']); @@ -152,7 +152,7 @@ class IndividualTest extends TestCase /** @test */ function birthday_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('birthday', '') ->call('register') ->assertHasErrors(['birthday' => 'required']); @@ -161,7 +161,7 @@ class IndividualTest extends TestCase /** @test */ function birthday_is_valid_birthday() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('birthday', '123123') ->call('register') ->assertHasErrors(['birthday' => 'date_format']); @@ -170,7 +170,7 @@ class IndividualTest extends TestCase /** @test */ function contribution_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('contribution', '') ->call('register') ->assertHasErrors(['contribution' => 'required']); @@ -179,7 +179,7 @@ class IndividualTest extends TestCase /** @test */ function contribution_is_valid_contribution() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('contribution', 'asdasdf') ->call('register') ->assertHasErrors(['contribution' => 'numeric']); @@ -188,7 +188,7 @@ class IndividualTest extends TestCase /** @test */ function discussion_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('discussion', '') ->call('register') ->assertHasErrors(['discussion' => 'required']); @@ -197,7 +197,7 @@ class IndividualTest extends TestCase /** @test */ function discussion_is_valid_discussion() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('discussion', 'asdasdf') ->call('register') ->assertHasErrors(['discussion' => 'in']); @@ -206,7 +206,7 @@ class IndividualTest extends TestCase /** @test */ function document_type_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('document.type', '') ->call('register') ->assertHasErrors(['document.type' => 'required']); @@ -215,7 +215,7 @@ class IndividualTest extends TestCase /** @test */ function document_number_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('document.number', '') ->call('register') ->assertHasErrors(['document.number' => 'required']); @@ -224,7 +224,7 @@ class IndividualTest extends TestCase /** @test */ function email_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('email', '') ->call('register') ->assertHasErrors(['email' => 'required']); @@ -233,7 +233,7 @@ class IndividualTest extends TestCase /** @test */ function email_is_valid_email() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('email', 'tallstack') ->call('register') ->assertHasErrors(['email' => 'email']); @@ -244,7 +244,7 @@ class IndividualTest extends TestCase { factory(Associate::class)->create(['email' => 'tallstack@example.com']); - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('email', 'tallstack@example.com') ->call('register') ->assertHasErrors(['email' => 'unique']); @@ -255,7 +255,7 @@ class IndividualTest extends TestCase { factory(Associate::class)->create(['email' => 'tallstack@example.com']); - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('email', 'smallstack@gmail.com') ->assertHasNoErrors() ->set('email', 'tallstack@example.com') @@ -266,7 +266,7 @@ class IndividualTest extends TestCase /** @test */ function name_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('name', '') ->call('register') ->assertHasErrors(['name' => 'required']); @@ -275,7 +275,7 @@ class IndividualTest extends TestCase /** @test */ function profile_bike_activities_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.bike_activities', '') ->call('register') ->assertHasNoErrors('profile.bike_activities'); @@ -284,7 +284,7 @@ class IndividualTest extends TestCase /** @test */ function profile_bike_use_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.bike_use', '') ->call('register') ->assertHasNoErrors('profile.bike_use'); @@ -293,7 +293,7 @@ class IndividualTest extends TestCase /** @test */ function profile_comments_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.comments', '') ->call('register') ->assertHasNoErrors('profile.comments'); @@ -302,7 +302,7 @@ class IndividualTest extends TestCase /** @test */ function profile_expectations_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.expectations', '') ->call('register') ->assertHasNoErrors('profile.expectations'); @@ -311,7 +311,7 @@ class IndividualTest extends TestCase /** @test */ function profile_gender_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.gender', '') ->call('register') ->assertHasErrors(['profile.gender' => 'required']); @@ -320,7 +320,7 @@ class IndividualTest extends TestCase /** @test */ function profile_gender_is_valid_gender() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.gender', 'asdasdf') ->call('register') ->assertHasErrors(['profile.gender' => 'in']); @@ -329,7 +329,7 @@ class IndividualTest extends TestCase /** @test */ function profile_occupation_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.occupation', '') ->call('register') ->assertHasErrors(['profile.occupation' => 'required']); @@ -338,7 +338,7 @@ class IndividualTest extends TestCase /** @test */ function profile_org_participation_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.org_participation', '') ->call('register') ->assertHasNoErrors('profile.org_participation'); @@ -347,7 +347,7 @@ class IndividualTest extends TestCase /** @test */ function profile_phone_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.phone', '') ->call('register') ->assertHasErrors(['profile.phone' => 'required']); @@ -356,7 +356,7 @@ class IndividualTest extends TestCase /** @test */ function profile_scholarity_is_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.scholarity', '') ->call('register') ->assertHasErrors(['profile.scholarity' => 'required']); @@ -365,7 +365,7 @@ class IndividualTest extends TestCase /** @test */ function profile_scholarity_is_valid_scholarity() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.scholarity', 'asdasdf') ->call('register') ->assertHasErrors(['profile.scholarity' => 'in']); @@ -374,7 +374,7 @@ class IndividualTest extends TestCase /** @test */ function profile_secondary_emails_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.secondary_emails', '') ->call('register') ->assertHasNoErrors('profile.secondary_emails'); @@ -383,7 +383,7 @@ class IndividualTest extends TestCase /** @test */ function profile_social_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.social', '') ->call('register') ->assertHasNoErrors('profile.social'); @@ -392,7 +392,7 @@ class IndividualTest extends TestCase /** @test */ function profile_website_is_not_required() { - Livewire::test('auth.register.individual') + Livewire::test('associates.auth.register.individual') ->set('profile.website', '') ->call('register') ->assertHasNoErrors('profile.website');