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

Password reset table on tenant database #25

Open
bkintanar opened this issue Jun 21, 2018 · 6 comments
Open

Password reset table on tenant database #25

bkintanar opened this issue Jun 21, 2018 · 6 comments

Comments

@bkintanar
Copy link
Member

Moved from tenancy/multi-tenant#443

It's possible to force the password reset entries to be saved on the tenant connection. In order to do so update the auth.php file and add the connection key like this:

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'connection' => 'tenant',
        ],
    ],
@Nowi5
Copy link

Nowi5 commented Jul 6, 2018

Can you please give a bit more guidance?
If I'm not wrong a hyn/multi-tenant application has 3 different connections:
default (mysql), system and tenant.

When I run the auth() pages without setting the connection to tenant or system in auth.php, he can't find the users table. Should be the system and the default system be the same to avoid such behavior, or should we set the default connection always to system? How to do so?

Thank you.

@bkintanar
Copy link
Member Author

@Nowi5 this package only suggest 2 database connection. System and Tenant db connection. Where is your users table located?

@Nowi5
Copy link

Nowi5 commented Jul 6, 2018

Yes this package add this two connection on top of laravel standard. So can't we merge system with laravel standard?

@luceos
Copy link
Contributor

luceos commented Jul 9, 2018

You can, it's up to you, most often it makes sense to set default to system.

@drbornot
Copy link

drbornot commented Feb 3, 2021

And in the case of multiples User models? This solution works as well? I mean, if I have system and tenant users using different guards and providers form them

@sniper7kills
Copy link
Contributor

I have 0 experience with tenancy/multi-tenant;

But in some experiments I did with multi-model authentication I came up with the following package.
https://github.com/sniper7kills/multimodelauth

I can't promise it'll be a solution, or event help in this case, but it allowed me to have two different models, on two different connections, use a single guard for authentication. (in fact you'll likely just want to use that repo as an example, and implement a well tested solution in your own project)

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

5 participants