lint fix
This commit is contained in:
parent
ad73cbade1
commit
502bc49042
|
@ -24,10 +24,12 @@ class ConfirmablePasswordController extends Controller
|
||||||
*/
|
*/
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
{
|
{
|
||||||
if (! Auth::guard('web')->validate([
|
if (
|
||||||
'email' => $request->user()->email,
|
! Auth::guard('web')->validate([
|
||||||
'password' => $request->password,
|
'email' => $request->user()->email,
|
||||||
])) {
|
'password' => $request->password,
|
||||||
|
])
|
||||||
|
) {
|
||||||
throw ValidationException::withMessages([
|
throw ValidationException::withMessages([
|
||||||
'password' => __('auth.password'),
|
'password' => __('auth.password'),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -56,6 +56,6 @@ class NewPasswordController extends Controller
|
||||||
return $status == Password::PASSWORD_RESET
|
return $status == Password::PASSWORD_RESET
|
||||||
? redirect()->route('login')->with('status', __($status))
|
? redirect()->route('login')->with('status', __($status))
|
||||||
: back()->withInput($request->only('email'))
|
: back()->withInput($request->only('email'))
|
||||||
->withErrors(['email' => __($status)]);
|
->withErrors(['email' => __($status)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,6 @@ class PasswordResetLinkController extends Controller
|
||||||
return $status == Password::RESET_LINK_SENT
|
return $status == Password::RESET_LINK_SENT
|
||||||
? back()->with('status', __($status))
|
? back()->with('status', __($status))
|
||||||
: back()->withInput($request->only('email'))
|
: back()->withInput($request->only('email'))
|
||||||
->withErrors(['email' => __($status)]);
|
->withErrors(['email' => __($status)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class RegisteredUserController extends Controller
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
|
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:' . User::class],
|
||||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,13 @@ class VerifyEmailController extends Controller
|
||||||
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
if ($request->user()->hasVerifiedEmail()) {
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->user()->markEmailAsVerified()) {
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
event(new Verified($request->user()));
|
event(new Verified($request->user()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,6 @@ class LoginRequest extends FormRequest
|
||||||
*/
|
*/
|
||||||
public function throttleKey(): string
|
public function throttleKey(): string
|
||||||
{
|
{
|
||||||
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
|
return Str::transliterate(Str::lower($this->string('email')) . '|' . $this->ip());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,13 @@ class ProfileUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
|
'email' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'lowercase',
|
||||||
|
'email',
|
||||||
|
'max:255',
|
||||||
|
Rule::unique(User::class)->ignore($this->user()->id)],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class () extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class () extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class () extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,47 +13,47 @@ use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware('guest')->group(function () {
|
Route::middleware('guest')->group(function () {
|
||||||
Route::get('register', [RegisteredUserController::class, 'create'])
|
Route::get('register', [RegisteredUserController::class, 'create'])
|
||||||
->name('register');
|
->name('register');
|
||||||
|
|
||||||
Route::post('register', [RegisteredUserController::class, 'store']);
|
Route::post('register', [RegisteredUserController::class, 'store']);
|
||||||
|
|
||||||
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
||||||
->name('login');
|
->name('login');
|
||||||
|
|
||||||
Route::post('login', [AuthenticatedSessionController::class, 'store']);
|
Route::post('login', [AuthenticatedSessionController::class, 'store']);
|
||||||
|
|
||||||
Route::get('forgot-password', [PasswordResetLinkController::class, 'create'])
|
Route::get('forgot-password', [PasswordResetLinkController::class, 'create'])
|
||||||
->name('password.request');
|
->name('password.request');
|
||||||
|
|
||||||
Route::post('forgot-password', [PasswordResetLinkController::class, 'store'])
|
Route::post('forgot-password', [PasswordResetLinkController::class, 'store'])
|
||||||
->name('password.email');
|
->name('password.email');
|
||||||
|
|
||||||
Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
|
Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
|
||||||
->name('password.reset');
|
->name('password.reset');
|
||||||
|
|
||||||
Route::post('reset-password', [NewPasswordController::class, 'store'])
|
Route::post('reset-password', [NewPasswordController::class, 'store'])
|
||||||
->name('password.store');
|
->name('password.store');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::middleware('auth')->group(function () {
|
Route::middleware('auth')->group(function () {
|
||||||
Route::get('verify-email', EmailVerificationPromptController::class)
|
Route::get('verify-email', EmailVerificationPromptController::class)
|
||||||
->name('verification.notice');
|
->name('verification.notice');
|
||||||
|
|
||||||
Route::get('verify-email/{id}/{hash}', VerifyEmailController::class)
|
Route::get('verify-email/{id}/{hash}', VerifyEmailController::class)
|
||||||
->middleware(['signed', 'throttle:6,1'])
|
->middleware(['signed', 'throttle:6,1'])
|
||||||
->name('verification.verify');
|
->name('verification.verify');
|
||||||
|
|
||||||
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
|
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
|
||||||
->middleware('throttle:6,1')
|
->middleware('throttle:6,1')
|
||||||
->name('verification.send');
|
->name('verification.send');
|
||||||
|
|
||||||
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
|
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
|
||||||
->name('password.confirm');
|
->name('password.confirm');
|
||||||
|
|
||||||
Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
|
Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
|
||||||
|
|
||||||
Route::put('password', [PasswordController::class, 'update'])->name('password.update');
|
Route::put('password', [PasswordController::class, 'update'])->name('password.update');
|
||||||
|
|
||||||
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
|
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
|
||||||
->name('logout');
|
->name('logout');
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,4 +17,4 @@ Route::middleware('auth')->group(function () {
|
||||||
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
require __DIR__.'/auth.php';
|
require __DIR__ . '/auth.php';
|
||||||
|
|
|
@ -10,14 +10,14 @@ class AuthenticationTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_login_screen_can_be_rendered(): void
|
public function testLoginScreenCanBeRendered(): void
|
||||||
{
|
{
|
||||||
$response = $this->get('/login');
|
$response = $this->get('/login');
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_users_can_authenticate_using_the_login_screen(): void
|
public function testUsersCanAuthenticateUsingTheLoginScreen(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class AuthenticationTest extends TestCase
|
||||||
$response->assertRedirect(route('dashboard', absolute: false));
|
$response->assertRedirect(route('dashboard', absolute: false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_users_can_not_authenticate_with_invalid_password(): void
|
public function testUsersCanNotAuthenticateWithInvalidPassword(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class AuthenticationTest extends TestCase
|
||||||
$this->assertGuest();
|
$this->assertGuest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_users_can_logout(): void
|
public function testUsersCanLogout(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class EmailVerificationTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_email_verification_screen_can_be_rendered(): void
|
public function testEmailVerificationScreenCanBeRendered(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->unverified()->create();
|
$user = User::factory()->unverified()->create();
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class EmailVerificationTest extends TestCase
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_email_can_be_verified(): void
|
public function testEmailCanBeVerified(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->unverified()->create();
|
$user = User::factory()->unverified()->create();
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ class EmailVerificationTest extends TestCase
|
||||||
|
|
||||||
Event::assertDispatched(Verified::class);
|
Event::assertDispatched(Verified::class);
|
||||||
$this->assertTrue($user->fresh()->hasVerifiedEmail());
|
$this->assertTrue($user->fresh()->hasVerifiedEmail());
|
||||||
$response->assertRedirect(route('dashboard', absolute: false).'?verified=1');
|
$response->assertRedirect(route('dashboard', absolute: false) . '?verified=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_email_is_not_verified_with_invalid_hash(): void
|
public function testEmailIsNotVerifiedWithInvalidHash(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->unverified()->create();
|
$user = User::factory()->unverified()->create();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class PasswordConfirmationTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_confirm_password_screen_can_be_rendered(): void
|
public function testConfirmPasswordScreenCanBeRendered(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class PasswordConfirmationTest extends TestCase
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_password_can_be_confirmed(): void
|
public function testPasswordCanBeConfirmed(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class PasswordConfirmationTest extends TestCase
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_password_is_not_confirmed_with_invalid_password(): void
|
public function testPasswordIsNotConfirmedWithInvalidPassword(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,14 @@ class PasswordResetTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_reset_password_link_screen_can_be_rendered(): void
|
public function testResetPasswordLinkScreenCanBeRendered(): void
|
||||||
{
|
{
|
||||||
$response = $this->get('/forgot-password');
|
$response = $this->get('/forgot-password');
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_reset_password_link_can_be_requested(): void
|
public function testResetPasswordLinkCanBeRequested(): void
|
||||||
{
|
{
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class PasswordResetTest extends TestCase
|
||||||
Notification::assertSentTo($user, ResetPassword::class);
|
Notification::assertSentTo($user, ResetPassword::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_reset_password_screen_can_be_rendered(): void
|
public function testResetPasswordScreenCanBeRendered(): void
|
||||||
{
|
{
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class PasswordResetTest extends TestCase
|
||||||
$this->post('/forgot-password', ['email' => $user->email]);
|
$this->post('/forgot-password', ['email' => $user->email]);
|
||||||
|
|
||||||
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
|
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
|
||||||
$response = $this->get('/reset-password/'.$notification->token);
|
$response = $this->get('/reset-password/' . $notification->token);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class PasswordResetTest extends TestCase
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_password_can_be_reset_with_valid_token(): void
|
public function testPasswordCanBeResetWithValidToken(): void
|
||||||
{
|
{
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class PasswordUpdateTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_password_can_be_updated(): void
|
public function testPasswordCanBeUpdated(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class PasswordUpdateTest extends TestCase
|
||||||
$this->assertTrue(Hash::check('new-password', $user->refresh()->password));
|
$this->assertTrue(Hash::check('new-password', $user->refresh()->password));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_correct_password_must_be_provided_to_update_password(): void
|
public function testCorrectPasswordMustBeProvidedToUpdatePassword(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,14 @@ class RegistrationTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_registration_screen_can_be_rendered(): void
|
public function testRegistrationScreenCanBeRendered(): void
|
||||||
{
|
{
|
||||||
$response = $this->get('/register');
|
$response = $this->get('/register');
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_new_users_can_register(): void
|
public function testNewUsersCanRegister(): void
|
||||||
{
|
{
|
||||||
$response = $this->post('/register', [
|
$response = $this->post('/register', [
|
||||||
'name' => 'Test User',
|
'name' => 'Test User',
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ProfileTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function test_profile_page_is_displayed(): void
|
public function testProfilePageIsDisplayed(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class ProfileTest extends TestCase
|
||||||
$response->assertOk();
|
$response->assertOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_profile_information_can_be_updated(): void
|
public function testProfileInformationCanBeUpdated(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class ProfileTest extends TestCase
|
||||||
$this->assertNull($user->email_verified_at);
|
$this->assertNull($user->email_verified_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_email_verification_status_is_unchanged_when_the_email_address_is_unchanged(): void
|
public function testEmailVerificationStatusIsUnchangedWhenTheEmailAddressIsUnchanged(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class ProfileTest extends TestCase
|
||||||
$this->assertNotNull($user->refresh()->email_verified_at);
|
$this->assertNotNull($user->refresh()->email_verified_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_user_can_delete_their_account(): void
|
public function testUserCanDeleteTheirAccount(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class ProfileTest extends TestCase
|
||||||
$this->assertNull($user->fresh());
|
$this->assertNull($user->fresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_correct_password_must_be_provided_to_delete_account(): void
|
public function testCorrectPasswordMustBeProvidedToDeleteAccount(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue