8000 PasswordResetLinkController ignores custom eloquent connection · Issue #55766 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

PasswordResetLinkController ignores custom eloquent connection #55766

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

Open
leonardocustodio opened this issue May 17, 2025 · 1 comment
Open

Comments

@leonardocustodio
Copy link
leonardocustodio commented May 17, 2025

Laravel Version

12.14.1

PHP Version

8.3.20

Database Driver & Version

Postgres

Description

Hello guys,

When using a custom $connection on a User class that extends the default Authenticatable things works nicely for Login + Logout + VerifyEmail without any changes anywhere.

The thing is if we requests a password reset, it seems that the controller ignores the $connection parameter even though all the others work fine.

My default configuration file for auth.php is:

return [
    'defaults' => [
        'guard' => env('AUTH_GUARD', 'web'),
        'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
    ],
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],
    ],
    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => env('AUTH_MODEL', App\Models\User::class),
        ],
    ],
    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
            'expire' => 60,
            'throttle' => 60,
        ],
    ],
    'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

I understand that this probably can be solved by creating a database provider and pass this new provider to passwords.users.provider but since everything else works like a charm, maybe it would be interesting to fix this on the PasswordResetLink too

Steps To Reproduce

  1. Use a postgres database with 2 schemas, the first schema will be used for data, the second schema for auth related things.

  2. Configure a new connection with the second search_path an example:

        'auth' => [
            ...$pgsql,
            'search_path' => 'auth',
        ],
  1. Use this connection on the User model:
    protected $connection = 'auth';
  1. Try to register, signin, signout, verify email, request a reset link. You will see everything will work with the exception of the reset link which seems to keep querying the default public schema. Resulting in the following error:
Illuminate\Database\QueryException
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "users" does not exist LINE 1: select * from "users" where "email" = $1 limit 1 ^ (Connection: pgsql, SQL: select * from "users" where "email" = leonardo@custodio.me limit 1)
@crynobone
Copy link
Member

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0