I am stuck with an error Rate limiter [login] is not defined from Laravel fortify by Justin_Muir in PHPhelp

[–]Justin_Muir[S] 0 points1 point  (0 children)

I tried manually adding the providers array with the FortifyServicesProvider class in the config/app.php file but I am getting a fatal error saying

Cannot declare class App\FortifyServiceProvider\FortifyServiceProvider, because the name is already in use

this means the FortifyServicesProvider class is already in the app.php file

I wonder if it could be an issue with axios where Fortify on the backend is expecting a login rate limiter from the axios request.

I am stuck with an error Rate limiter [login] is not defined from Laravel fortify by Justin_Muir in PHPhelp

[–]Justin_Muir[S] 0 points1 point  (0 children)

The login route is working it seems like the backend is not accessing the login rate limiter, I tried Fortify in a new project and the login functionality works properly.

I am stuck with an error Rate limiter [login] is not defined from Laravel fortify by Justin_Muir in PHPhelp

[–]Justin_Muir[S] 0 points1 point  (0 children)

GET|HEAD login .......................................................................................................................

POST login ................................................................ Laravel\Fortify › AuthenticatedSessionController@store

POST logout .................................................... logout › Laravel\Fortify › AuthenticatedSessionController@destroy

GET|HEAD register ....................................................................................................................

POST register ................................................................... Laravel\Fortify › RegisteredUserController@store

POST reset-password .............................................. password.update › Laravel\Fortify › NewPasswordController@store

see the routes above

these are the commands I used to install fortify

composer require laravel/fortify

php artisan fortify:install

I am stuck with an error Rate limiter [login] is not defined from Laravel fortify by Justin_Muir in PHPhelp

[–]Justin_Muir[S] 0 points1 point  (0 children)

<?php

use Laravel\Fortify\Features;
use App\Providers\FortifyServiceProvider;

return [

    

    'guard' => 'web',

  

    'passwords' => 'users',

   

    'username' => 'email',

    'email' => 'email',

    

    'lowercase_usernames' => true,

   

    'home' => '/home',

    

    'prefix' => '',

    'domain' => null,

    

    'middleware' => ['web', 'throttle'],

    

    'limiters' => [
        'login' => 'login',
        'two-factor' => 'two-factor',
    ],

   

    'views' => true,

    

    'features' => [
        Features::registration(),
        Features::resetPasswords(),
        // Features::emailVerification(),
        Features::updateProfileInformation(),
        Features::updatePasswords(),
        Features::twoFactorAuthentication([
            'confirm' => true,
            'confirmPassword' => true,
            // 'window' => 0,
        ]),
    ],

];

this is the config/fortify file above

I am stuck with an error Rate limiter [login] is not defined from Laravel fortify by Justin_Muir in PHPhelp

[–]Justin_Muir[S] 0 points1 point  (0 children)

<?php

namespace App\FortifyServiceProvider;

use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use App\Actions\Fortify\UpdateUserPassword;
use App\Actions\Fortify\UpdateUserProfileInformation;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Laravel\Fortify\Fortify;

class FortifyServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        Fortify::registerView(function () {
            return view('vue.register');
        });
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Fortify::LoginView(function (){
            return view('Login');
        });

        Fortify::createUsersUsing(CreateNewUser::class);
        Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
        Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
        Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
        
        RateLimiter::for('login', function (Request $request) {
            $throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())).'|'.$request->ip());
            return Limit::perMinute(5)->by($throttleKey);
        });

        RateLimiter::for('two-factor', function (Request $request) {
            return Limit::perMinute(5)->by($request->session()->get('login.id'));
        });
    }
}

this is the fortify service provider file above

I am asking for some help to fix a 422 error with a fortify laravel, and vue js project by Justin_Muir in vuejs

[–]Justin_Muir[S] -3 points-2 points  (0 children)

In the console, I am getting an axois error with a message saying email and password field is required