Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding Fortify's Authentication custom LoginRequest #385

Closed
majweb opened this issue Nov 13, 2024 · 1 comment
Closed

Overriding Fortify's Authentication custom LoginRequest #385

majweb opened this issue Nov 13, 2024 · 1 comment
Labels
bug Something isn't working needs more info

Comments

@majweb
Copy link

majweb commented Nov 13, 2024

Stack

Jetstream – Vue with Inertia

Package Version

6.1.9

Laravel Version

10

Livewire Version

No response

react Version

No response

Vue Version

3.0

PHP Version

8.2

Problem description

When I change LoginRequest to a custom class. This error appears when logging in again.(after register)

LoginRequest 

<?php

namespace App\Http\Requests;
use Laravel\Fortify\Http\Requests\LoginRequest as FortifyLoginRequest;
use Laravel\Fortify\Fortify;

class LoginRequest extends FortifyLoginRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
![chrome_SQlIl924F6](https://github.com/user-attachments/assets/966c0a85-8fba-4891-b4bb-786ae6102a1d)

            Fortify::username() => 'required|string',
            'password' => 'required|string',
            'type' => ['required', 'in:firm,client'],
        ];
    }

    public function attributes(): array
    {
        return [
            'password' => "hasło",
            'type' => "typ konta",
        ];
    }
}
FortifyServiceProvider

 Fortify::authenticateUsing(function (LoginRequest $request) {...

AppserviceProvider.

    public function boot(): void
    {
        $this->app->bind('Laravel\Fortify\Http\Requests\LoginRequest', \App\Http\Requests\LoginRequest::class);
         ...

chrome_SQlIl924F6

Expected behavior

Login

Steps to reproduce

login

Reproduction repository

https://xxx

Relevant log output

data
@majweb majweb added the bug Something isn't working label Nov 13, 2024
Copy link

Hey @majweb! We're sorry to hear that you've hit this issue. 💙

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Socialstream code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

Also, it doesn't look like you've provided much information on how to replicate the issue. Please edit your original post with clear steps we need to take.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs more info
Projects
None yet
Development

No branches or pull requests

1 participant