Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d171e29
Refactor authentication routes and migrate view logic to Fortify inte…
pushpak1300 Oct 10, 2025
821bdef
WIP
pushpak1300 Oct 10, 2025
07c41eb
Replace verify email with fortify
pushpak1300 Oct 10, 2025
d3a8e7c
Replace forget password with fortify
pushpak1300 Oct 10, 2025
5ea8cc5
Replace register with fortify
pushpak1300 Oct 10, 2025
3b9d30e
WIP
pushpak1300 Oct 10, 2025
4c879d7
linting changes
pushpak1300 Oct 10, 2025
c7c597f
Refactor authentication routes and migrate view logic to Fortify inte…
pushpak1300 Oct 10, 2025
034974c
Replace forget password with fortify
pushpak1300 Oct 10, 2025
f3ee5b5
Merge branch 'replace_password_reset_with_fortify' into repalce_regis…
pushpak1300 Oct 12, 2025
ef476b0
refactor FortifyServiceProvider.php
pushpak1300 Oct 12, 2025
09ceb87
enable fortify Register fature
pushpak1300 Oct 12, 2025
15940f4
show register route conditionally
pushpak1300 Oct 12, 2025
20a2182
fix test
pushpak1300 Oct 12, 2025
7600f6c
refactor register component to use store for form handling
pushpak1300 Oct 12, 2025
7aa0ce0
Refactor FortifyServiceProvider to modularize view and rate-limiting …
pushpak1300 Oct 13, 2025
074edb7
Merge branch 'replace_login_with_fortify' into replace_email_verifica…
pushpak1300 Oct 13, 2025
307996e
Merge branch 'replace_email_verification_with_fortify' into replace_p…
pushpak1300 Oct 13, 2025
92f2e62
Merge branch 'replace_password_reset_with_fortify' into repalce_regis…
pushpak1300 Oct 13, 2025
0c622f5
Merge branch 'replace_login_with_fortify' into replace_email_verifica…
pushpak1300 Oct 13, 2025
6d7577c
Merge branch 'replace_email_verification_with_fortify' into replace_p…
pushpak1300 Oct 13, 2025
b931cb3
Merge branch 'replace_password_reset_with_fortify' into repalce_regis…
pushpak1300 Oct 13, 2025
e3c144c
Merge branch 'main' into repalce_register_with_fortify
pushpak1300 Oct 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Actions\Fortify;

use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\CreatesNewUsers;

class CreateNewUser implements CreatesNewUsers
{
use PasswordValidationRules;

/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
*/
public function create(array $input): User
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => [
'required',
'string',
'email',
'max:255',
Rule::unique(User::class),
],
'password' => $this->passwordRules(),
])->validate();

return User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]);
}
}
18 changes: 18 additions & 0 deletions app/Actions/Fortify/PasswordValidationRules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Actions\Fortify;

use Illuminate\Validation\Rules\Password;

trait PasswordValidationRules
{
/**
* Get the validation rules used to validate passwords.
*
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
*/
protected function passwordRules(): array
{
return ['required', 'string', Password::default(), 'confirmed'];
}
}
29 changes: 29 additions & 0 deletions app/Actions/Fortify/ResetUserPassword.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Actions\Fortify;

use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;

class ResetUserPassword implements ResetsUserPasswords
{
use PasswordValidationRules;

/**
* Validate and reset the user's forgotten password.
*
* @param array<string, string> $input
*/
public function reset(User $user, array $input): void
{
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();

$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}

This file was deleted.

22 changes: 0 additions & 22 deletions app/Http/Controllers/Auth/EmailVerificationPromptController.php

This file was deleted.

68 changes: 0 additions & 68 deletions app/Http/Controllers/Auth/NewPasswordController.php

This file was deleted.

41 changes: 0 additions & 41 deletions app/Http/Controllers/Auth/PasswordResetLinkController.php

This file was deleted.

52 changes: 0 additions & 52 deletions app/Http/Controllers/Auth/RegisteredUserController.php

This file was deleted.

24 changes: 0 additions & 24 deletions app/Http/Controllers/Auth/VerifyEmailController.php

This file was deleted.

28 changes: 28 additions & 0 deletions app/Providers/FortifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace App\Providers;

use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
Expand All @@ -26,20 +28,46 @@ public function register(): void
*/
public function boot(): void
{
$this->configureActions();
$this->configureViews();
$this->configureRateLimiting();
}

/**
* Configure Fortify actions.
*/
private function configureActions(): void
{
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
Fortify::createUsersUsing(CreateNewUser::class);
}

/**
* Configure Fortify views.
*/
private function configureViews(): void
{
Fortify::loginView(fn (Request $request) => Inertia::render('auth/Login', [
'canResetPassword' => Features::enabled(Features::resetPasswords()),
'canRegister' => Features::enabled(Features::registration()),
'status' => $request->session()->get('status'),
]));

Fortify::resetPasswordView(fn (Request $request) => Inertia::render('auth/ResetPassword', [
'email' => $request->email,
'token' => $request->route('token'),
]));

Fortify::requestPasswordResetLinkView(fn (Request $request) => Inertia::render('auth/ForgotPassword', [
'status' => $request->session()->get('status'),
]));

Fortify::verifyEmailView(fn (Request $request) => Inertia::render('auth/VerifyEmail', [
'status' => $request->session()->get('status'),
]));

Fortify::registerView(fn () => Inertia::render('auth/Register'));

Fortify::twoFactorChallengeView(fn () => Inertia::render('auth/TwoFactorChallenge'));

Fortify::confirmPasswordView(fn () => Inertia::render('auth/ConfirmPassword'));
Expand Down
8 changes: 3 additions & 5 deletions config/fortify.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,9 @@
*/

'features' => [
// Features::registration(),
// Features::resetPasswords(),
// Features::emailVerification(),
// Features::updateProfileInformation(),
// Features::updatePasswords(),
Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::twoFactorAuthentication([
'confirm' => true,
'confirmPassword' => true,
Expand Down
Loading
Loading