Closed curtisdelicata closed 6 months ago
29317e920d
)[!TIP] I'll email you at genealogysoftwareuk@gmail.com when I complete this pull request!
Here are the GitHub Actions logs prior to making any changes:
537ae52
Checking routes/landlord.php for syntax errors... ✅ routes/landlord.php has no syntax errors!
1/1 ✓Checking routes/landlord.php for syntax errors... ✅ routes/landlord.php has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
routes/landlord.php
✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/95534ca23fdfc0640b9cacb69a55e05c73a05afe Edit
Modify routes/landlord.php with contents:
• Remove all custom route definitions for landlord registration, login, password reset, and email verification.
• Since we are integrating Filament's native authentication, these custom routes are no longer necessary.
--- +++ @@ -1,24 +1,3 @@ <?php use Illuminate\Support\Facades\Route; -use App\Http\Controllers\LandlordAuthController; -use App\Http\Controllers\LandlordPasswordResetController; -use App\Http\Controllers\LandlordVerificationController; - -// Landlord Registration -Route::get('/register', [LandlordAuthController::class, 'registerForm'])->name('landlord.register.form'); -Route::post('/register', [LandlordAuthController::class, 'register'])->name('landlord.register'); - -// Landlord Login -Route::get('/login', [LandlordAuthController::class, 'loginForm'])->name('landlord.login.form'); -Route::post('/login', [LandlordAuthController::class, 'login'])->name('landlord.login'); - -// Landlord Password Reset -Route::get('/password/reset', [LandlordPasswordResetController::class, 'showResetRequestForm'])->name('landlord.password.request'); -Route::post('/password/email', [LandlordPasswordResetController::class, 'sendResetLinkEmail'])->name('landlord.password.email'); -Route::get('/password/reset/{token}', [LandlordPasswordResetController::class, 'showResetForm'])->name('landlord.password.reset.form'); -Route::post('/password/reset', [LandlordPasswordResetController::class, 'reset'])->name('landlord.password.update'); - -// Landlord Verification -Route::get('/email/verify', [LandlordVerificationController::class, 'show'])->name('landlord.verification.notice'); -Route::get('/email/verify/{id}/{hash}', [LandlordVerificationController::class, 'verify'])->name('landlord.verification.verify')->middleware(['signed', 'throttle:6,1']);
routes/landlord.php
✓ Edit
Check routes/landlord.php with contents:
Ran GitHub Actions for 95534ca23fdfc0640b9cacb69a55e05c73a05afe:
app/Http/Controllers/Landlord/AuthController.php
✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/536df0a38d3e2a7bd42fe16310c9c17da8ebfafb Edit
Modify app/Http/Controllers/Landlord/AuthController.php with contents:
• Remove or comment out the entire content of the AuthController for landlords.
• This controller's custom authentication logic will be replaced by Filament's native authentication system.
--- +++ @@ -1,81 +1 @@ -<?php - -namespace App\Http\Controllers\Landlord; - -use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; -use Illuminate\Foundation\Auth\AuthenticatesUsers; -use Illuminate\Foundation\Auth\RegistersUsers; -use Illuminate\Foundation\Auth\ResetsPasswords; -use Illuminate\Foundation\Auth\VerifiesEmails; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Hash; -use Illuminate\Support\Facades\Password; -use Illuminate\Support\Facades\Validator; -use Illuminate\Http\Request; -use Illuminate\Http\RedirectResponse; - -class AuthController extends Controller -{ - use AuthenticatesUsers, RegistersUsers, ResetsPasswords, VerifiesEmails; - - protected $redirectTo = RouteServiceProvider::HOME; - - public function __construct() - { - $this->middleware('guest:landlord')->except('logout'); - } - - protected function guard() - { - return Auth::guard('landlord'); - } - - protected function broker() - { - return Password::broker('landlords'); - } - - public function showLoginForm() - { - return view('landlord.auth.login'); - } - - public function showRegistrationForm() - { - return view('landlord.auth.register'); - } - - public function showLinkRequestForm() - { - return view('landlord.auth.passwords.email'); - } - - public function showResetForm(Request $request, $token = null) - { - return view('landlord.auth.passwords.reset')->with(['token' => $token, 'email' => $request->email]); - } - - public function showVerificationNotice() - { - return view('landlord.auth.verify'); - } - - protected function validator(array $data) - { - return Validator::make($data, [ - 'name' => ['required', 'string', 'max:255'], - 'email' => ['required', 'string', 'email', 'max:255', 'unique:landlords'], - 'password' => ['required', 'string', 'min:8', 'confirmed'], - ]); - } - - protected function create(array $data) - { - return Auth::guard('landlord')->create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => Hash::make($data['password']), - ]); - } -} +// This file has been emptied in preparation for migration to Filament's native authentication system.
app/Http/Controllers/Landlord/AuthController.php
✓ Edit
Check app/Http/Controllers/Landlord/AuthController.php with contents:
Ran GitHub Actions for 536df0a38d3e2a7bd42fe16310c9c17da8ebfafb:
app/Providers/Filament/LandlordPanelProvider.php
✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/b72aaeab6b36a142b63e7c35e46e08f881c08cc5 Edit
Modify app/Providers/Filament/LandlordPanelProvider.php with contents:
• Add Filament's native authentication routes to the landlord panel by ensuring the ->login(), ->register(), ->resetPasswords(), and ->verifyEmails() methods are called on the panel configuration if not already present.
• This integrates Filament's authentication system into the landlord panel, replacing the custom implementation.
--- +++ @@ -26,7 +26,7 @@ ->default() ->id('landlord') ->path('landlord') - ->login() + ->login()->register()->resetPasswords()->verifyEmails() ->colors([ 'primary' => Color::Amber, ])
app/Providers/Filament/LandlordPanelProvider.php
✓ Edit
Check app/Providers/Filament/LandlordPanelProvider.php with contents:
Ran GitHub Actions for b72aaeab6b36a142b63e7c35e46e08f881c08cc5:
app/Providers/Filament/ContractorPanelProvider.php
✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/4fa45f11e3ff8e63151c868a49a8d13e98512ec2 Edit
Modify app/Providers/Filament/ContractorPanelProvider.php with contents:
• Ensure that the contractor panel also uses Filament's native authentication by checking and adding ->login(), ->register(), ->resetPasswords(), and ->verifyEmails() methods to the panel configuration if they are missing.
• This change is based on the assumption that contractors also have a custom authentication system similar to landlords, which needs to be replaced with Filament's system.
--- +++ @@ -23,7 +23,7 @@ ->default() ->id('contractor') ->path('contractor') - ->login() + ->login()->register()->resetPasswords()->verifyEmails() ->discoverResources(in: app_path('Filament/Resources/Contractors'), for: 'App\\Filament\\Resources\\Contractors') ->discoverPages(in: app_path('Filament/Pages/Contractors'), for: 'App\\Filament\\Pages\\Contractors') ->discoverWidgets(in: app_path('Filament/Widgets/Contractors'), for: 'App\\Filament\\Widgets\\Contractors')
app/Providers/Filament/ContractorPanelProvider.php
✓ Edit
Check app/Providers/Filament/ContractorPanelProvider.php with contents:
Ran GitHub Actions for 4fa45f11e3ff8e63151c868a49a8d13e98512ec2:
app/Filament/Resources/TenantResource.php
✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/12d2e5d67e9784389d44dff8cd85d3da9e547b4a Edit
Modify app/Filament/Resources/TenantResource.php with contents:
• Comment out or remove the custom authentication handling methods (handleLogin, handleRegister, handleVerification, handleReset) since Filament's native authentication will be used.
• These custom methods are no longer necessary as Filament provides built-in support for these functionalities.
--- +++ @@ -55,33 +55,33 @@ ]); } - protected static function handleLogin(array $data) - { - if (!Auth::attempt($data)) { - throw ValidationException::withMessages([ - 'email' => [__('auth.failed')], - ]); - } - } + // protected static function handleLogin(array $data) + // { + // if (!Auth::attempt($data)) { + // throw ValidationException::withMessages([ + // 'email' => [__('auth.failed')], + // ]); + // } + // } - protected static function handleRegister(array $data) - { - // Registration logic here - } + // protected static function handleRegister(array $data) + // { + // // Registration logic here + // } - protected static function handleVerification(array $data) - { - // Verification logic here - } + // protected static function handleVerification(array $data) + // { + // // Verification logic here + // } - protected static function handleReset(array $data) - { - $status = Password::sendResetLink($data); + // protected static function handleReset(array $data) + // { + // $status = Password::sendResetLink($data); - if ($status !== Password::RESET_LINK_SENT) { - throw ValidationException::withMessages([ - 'email' => [__($status)], - ]); - } - } + // if ($status !== Password::RESET_LINK_SENT) { + // throw ValidationException::withMessages([ + // 'email' => [__($status)], + // ]); + // } + // } }
app/Filament/Resources/TenantResource.php
✓ Edit
Check app/Filament/Resources/TenantResource.php with contents:
Ran GitHub Actions for 12d2e5d67e9784389d44dff8cd85d3da9e547b4a:
app/Providers/EventServiceProvider.php
✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/6d9cb4ba6f11c8228ca8e2e87ae6e6e9ed9d8ebb Edit
Modify app/Providers/EventServiceProvider.php with contents:
• Ensure that any custom event listeners related to the old authentication system are reviewed and removed if they are no longer relevant.
• This cleanup is necessary to avoid conflicts or redundant operations now that the application is using Filament's authentication system.
--- +++ @@ -15,9 +15,9 @@ * @var array> */ protected $listen = [ - Registered::class => [ - SendEmailVerificationNotification::class, - ], + // Registered::class => [ + // SendEmailVerificationNotification::class, + // ], ]; /**
app/Providers/EventServiceProvider.php
✓ Edit
Check app/Providers/EventServiceProvider.php with contents:
Ran GitHub Actions for 6d9cb4ba6f11c8228ca8e2e87ae6e6e9ed9d8ebb:
I have finished reviewing the code for completeness. I did not find errors for sweep/remove_auth
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Details
Remove all custom login, register, verification, reset code and add the native filament 3 lines to all the panels for registration, verification, reset and login
Checklist
- [X] Modify `routes/landlord.php` ✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/95534ca23fdfc0640b9cacb69a55e05c73a05afe [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/routes/landlord.php#L7-L23) - [X] Running GitHub Actions for `routes/landlord.php` ✓ [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/routes/landlord.php#L7-L23) - [X] Modify `app/Http/Controllers/Landlord/AuthController.php` ✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/536df0a38d3e2a7bd42fe16310c9c17da8ebfafb [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Http/Controllers/Landlord/AuthController.php) - [X] Running GitHub Actions for `app/Http/Controllers/Landlord/AuthController.php` ✓ [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Http/Controllers/Landlord/AuthController.php) - [X] Modify `app/Providers/Filament/LandlordPanelProvider.php` ✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/b72aaeab6b36a142b63e7c35e46e08f881c08cc5 [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Providers/Filament/LandlordPanelProvider.php#L22-L58) - [X] Running GitHub Actions for `app/Providers/Filament/LandlordPanelProvider.php` ✓ [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Providers/Filament/LandlordPanelProvider.php#L22-L58) - [X] Modify `app/Providers/Filament/ContractorPanelProvider.php` ✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/4fa45f11e3ff8e63151c868a49a8d13e98512ec2 [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Providers/Filament/ContractorPanelProvider.php#L19-L42) - [X] Running GitHub Actions for `app/Providers/Filament/ContractorPanelProvider.php` ✓ [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Providers/Filament/ContractorPanelProvider.php#L19-L42) - [X] Modify `app/Filament/Resources/TenantResource.php` ✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/12d2e5d67e9784389d44dff8cd85d3da9e547b4a [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Filament/Resources/TenantResource.php#L58-L85) - [X] Running GitHub Actions for `app/Filament/Resources/TenantResource.php` ✓ [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Filament/Resources/TenantResource.php#L58-L85) - [X] Modify `app/Providers/EventServiceProvider.php` ✓ https://github.com/liberu-real-estate/real-estate-laravel/commit/6d9cb4ba6f11c8228ca8e2e87ae6e6e9ed9d8ebb [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Providers/EventServiceProvider.php#L16-L19) - [X] Running GitHub Actions for `app/Providers/EventServiceProvider.php` ✓ [Edit](https://github.com/liberu-real-estate/real-estate-laravel/edit/sweep/remove_auth/app/Providers/EventServiceProvider.php#L16-L19)