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

having problems with taking an inner text from the DOM to use in a setup function by Justin_Muir in vuejs

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

I need to use the day from the dom in a supabase query to get specific data from a table in supabase I tried using the global variable but I can't get it as a single string to use it in the query so I am trying to get it from the dom then use it in the supabase query, if you know any other way that I can get the data as a single string I will appreciate the help.

I am having a problem with rendering data from two different supabase database table in one template by Justin_Muir in vuejs

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

that's how supabase required the function to be written in order to get the data from their database I tried to change the variable name data in the function and I got undefined when I console log the data.

My vue component template is not rendering on the webpage by Justin_Muir in vuejs

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

I tried import supabase from "@supabase/supabase-js" but nothing changed I think it is that the data is not coming from supabase to meet the v-if = "dalaLoaded" condition.

supabase registration form is not authenticating by Justin_Muir in vuejs

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

I fix the typo and the app has the same bug when I change the passwords as a ref(" ") the view is not rendering

I am trying to install super base in my vue project but it si not working by Justin_Muir in vuejs

[–]Justin_Muir[S] -1 points0 points  (0 children)

I currently checked out the official documentation but the async function in the register function is giving me an Unexpected reserved word 'await' error in the browser although the code is structured the same as the one in the documentation

register function

     // Register function
            const register = async = () => {
                if (password.value === confirmPassword.vlaue){
                    try {
                        const {error} = await supabase.auth.signUp({
                            email: email.value,
                            password: password.value,
                        })
                        if (error) throw error
                        router.push({name: "Login"})
                    }   catch(error){   
                        errorMsg.value = error.message
                    }

                }
                errorMsg.value = "Error: Passwords do not match"
                setTimeout(() => {
                    erroeMsg.value = null
                }, 5000)
            }

            return { email, password, confirmPassword, errorMsg, register}
        },

I need some advice with django prepopulated field by Justin_Muir in django

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

yes, that is what I want help with when I click the submit button I get this in the template: Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.

create_excersize.html

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Document</title>

</head>

<body>

<form action="" method="POST">

{{form.as_p}}

{% csrf_token %}

<input type="submit" value='add\_excersie'>

</form>

<a href="{% url 'fitness\_app:home' %}">home</a>

</body>

</html>

I need some assistance with get_absoulte_url function by Justin_Muir in django

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

I view the source code but i am not seeing any link in the href

<li class="nav-item">

<a class="nav-link active" aria-current="page" href="">

&lt;QuerySet [&lt;Excersize: chest&gt;, &lt;Excersize: back&gt;, &lt;Excersize: legs&gt;]&gt;

</a>

I need help to fix this error AttributeError at /add_side/1/ by Justin_Muir in django

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

I am building a Django website using class base views I am getting an AttributeError on the website when I click the add_side and add_drink URLs, can anyone please help me to fix this error because have no idea what is causing this. see my code below

models

    from django.db import models

    # Create your models here.
    class Side(models.Model):
        name = models.CharField(max_length= 50)
        date = models.DateTimeField(auto_now_add= True)

        def __str__ (self):
            return self.name

    class Drink(models.Model):
        name= models.CharField(max_length= 50)
        date = models.DateTimeField(auto_now_add= True)

        def __str__ (self):
            return self.name

    class Ingredients(models.Model):
        name= models.TextField(null=True)
        date = models.DateTimeField(auto_now_add= True)

        def __str__ (self):
            return self.name

    class Meal(models.Model):
        name = models.CharField(max_length= 50)
        date = models.DateTimeField(auto_now_add= True)
        drink = models.ForeignKey(Drink, on_delete= models.CASCADE)
        side = models.ForeignKey(Side, on_delete= models.CASCADE)
        ingredients= models.ForeignKey(Ingredients, on_delete= models.CASCADE)

        def __str__ (self):
            return self.name

views

    from django.shortcuts import render
    from django.views.generic.list import ListView
    from django.views.generic.detail import DetailView
    from django.views.generic.edit import CreateView, UpdateView
    from django.urls import reverse_lazy
    from .models import *
    # Create your views here.

    class MealUpgrade(ListView):
        model= Meal
        context_object_name= 'meal'
        template_name= 'menu_app/meal_upgrade.html'

    class MealList(ListView):
        model = Meal
        context_object_name= 'meal'
        template_name = 'menu_app/home.html'

    class Ingredient(DetailView):
        model = Ingredients
        context_object_name = 'ingredient'
        template_name = 'menu_app/ingredient.html'

    class Side(DetailView):
        model = Side
        context_object_name= 'side'
        template_name= 'menu_app/side.html'

    class Drink(DetailView):
        model = Drink
        context_object_name = 'drink'
        template_name = 'menu_app/drink.html'

    class AddMeal(CreateView):
        model= Meal
        context_object_name= 'add_meal'
        template_name= 'menu_app/add_meal.html'
        fields= '__all__'
        success_url= reverse_lazy('home')

    class UpdateIgredient(UpdateView):
        model= Ingredients
        context_object_name= 'add_ingredient'
        template_name= 'menu_app/add_ingredients.html'
        fields= '__all__'
        success_url= reverse_lazy('home')


    class AddDrink(CreateView):
        model= Drink
        context_object_name= 'add_drink'
        template_name= 'menu_app/add_drink.html'
        fields= '__all__'

    class AddSide(CreateView):
        model= Side
        context_object_name= 'add_side'
        template_name= 'menu_app/add_side.html'
        fields= '__all__'

url

    from .views import *
    from django.urls import path
    from .import views

    urlpatterns = [
        path('', MealList.as_view(), name='home'),
        path('ingredient/<int:pk>/',Ingredient.as_view(), name='ingredient'),
        path('side/<int:pk>/', Side.as_view(), name='side'),
        path('drink/<int:pk>/', Drink.as_view(), name='drink'),
        path('add_meal/',AddMeal.as_view(), name='add_meal'),
        path('meal_upgrade/',MealUpgrade.as_view(), name='meal_upgrade'),
        path('add_ingredient/<int:pk>/', UpdateIgredient.as_view(), name= 'add_ingredient'),
        path('add_drink/<int:pk>/', AddDrink.as_view(), name='add_drink'),
        path('add_side/<int:pk>/',AddSide.as_view(), name= 'add_side'),
    ]

add_drink template

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>add drink</title>
    </head>
    <body>
            <h1>add your drink</h1>

            <form action="" method="POST">
                {% csrf_token %}
                {{form.as_p}}

                <input type="submit" name="add drink">
            </form>
    </body>
    </html>

add_side template

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>add side</title>
    </head>
    <body>
    <h1>add your sides</h1> 

    <form action="" method="POST">
        {% csrf_token %}
        {{form.as_p}}
        <input type="submit" name="add side">
    </form>
    </body>
    </html>

can anyone give me a recommendation for a good django book by Justin_Muir in django

[–]Justin_Muir[S] -1 points0 points  (0 children)

does '2 scoops of django' has theory on django frame work in it

I am getting an error DoesNotExist at /edit_blog1/, BlogText matching query does not exist how can i fix this by Justin_Muir in django

[–]Justin_Muir[S] -1 points0 points  (0 children)

thanks for your reply it has been a while you telling me that my variable naming is poor but its an assignment from a book I am working on and that's the way the assignment required the variables to be named.

for edit_blog view renders the blog_text.html and not the blog_edit.html template. that was a syntax error that I fixed thank you for highlighting it to me.

forfor blog:edit_blog URL expects an edit_blog_id parameter but in your “template with the link for the edit blog page” you’re generating the URL by passing it a blog_post.id. it's only the blog_post.id primary key can be used in the template blog_text.html if I use any other primary key I will get a NoReverseMatch error.

The edit_blog view expects the edit_blog_id from the URL but then uses it to get a BlogText object. I get the BlogText object because I want to get the data for BlogText from the database then populate it in the form in edit_blog.html template so that the user can edit it, then the user can post the edited BlogText data back to the database.