complete story 1.3 with qa test & added future recommendations to the dev

This commit is contained in:
Naser Mansour
2025-12-26 14:04:24 +02:00
parent 84d9c2f66a
commit ebb6841ed0
29 changed files with 760 additions and 101 deletions
+28 -1
View File
@@ -4,11 +4,18 @@ namespace App\Providers;
use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use App\Enums\UserStatus;
use App\Http\Responses\LoginResponse;
use App\Http\Responses\VerifyEmailResponse;
use App\Models\User;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;
use Laravel\Fortify\Contracts\VerifyEmailResponse as VerifyEmailResponseContract;
use Laravel\Fortify\Fortify;
class FortifyServiceProvider extends ServiceProvider
@@ -18,7 +25,8 @@ class FortifyServiceProvider extends ServiceProvider
*/
public function register(): void
{
//
$this->app->singleton(LoginResponseContract::class, LoginResponse::class);
$this->app->singleton(VerifyEmailResponseContract::class, VerifyEmailResponse::class);
}
/**
@@ -26,11 +34,30 @@ class FortifyServiceProvider extends ServiceProvider
*/
public function boot(): void
{
$this->configureAuthentication();
$this->configureActions();
$this->configureViews();
$this->configureRateLimiting();
}
/**
* Configure custom authentication logic.
*/
private function configureAuthentication(): void
{
Fortify::authenticateUsing(function (Request $request) {
$user = User::where('email', $request->email)->first();
if ($user &&
Hash::check($request->password, $user->password) &&
$user->status === UserStatus::Active) {
return $user;
}
return null;
});
}
/**
* Configure Fortify actions.
*/